public static String readSlingId()

in src/main/java/org/apache/sling/settings/impl/SlingIdUtil.java [43:64]


    public static String readSlingId(final File idFile) throws IOException {
        if (idFile.exists() && idFile.length() >= SLING_ID_LENGTH) {
            DataInputStream dis = null;
            try {
                final byte[] rawBytes = new byte[SLING_ID_LENGTH];
                dis = new DataInputStream(new FileInputStream(idFile));
                dis.readFully(rawBytes);
                final String rawString = new String(rawBytes, "ISO-8859-1");

                // roundtrip to ensure correct format of UUID value
                return UUID.fromString(rawString).toString();
            } finally {
                if (dis != null) {
                    try {
                        dis.close();
                    } catch (IOException ignore) {
                    }
                }
            }
        }
        return null;
    }