class KeePassHeader {

    public void checkVersionSupport(byte[] keepassFile) throws IOException {
        BufferedInputStream inputStream = new BufferedInputStream(new ByteArrayInputStream(keepassFile));

        byte[] signature = new byte[VERSION_SIGNATURE_LENGTH];
        int readBytes = inputStream.read(signature);
        if (readBytes == -1) {
            throw new UnsupportedOperationException("Could not read KeePass header. The provided file seems to be no KeePass database file!");
        }

        ByteBuffer signatureBuffer = ByteBuffer.wrap(signature);
        signatureBuffer.order(ByteOrder.LITTLE_ENDIAN);

        int signaturePart1 = ByteUtils.toUnsignedInt(signatureBuffer.getInt());
        int signaturePart2 = ByteUtils.toUnsignedInt(signatureBuffer.getInt());
        int version = signatureBuffer.getInt();
        this.fileFormatVersion = version;

        if (signaturePart1 == DATABASE_V2_FILE_SIGNATURE_1_INT && signaturePart2 == DATABASE_V2_FILE_SIGNATURE_2_INT) {
            if(!isVersionSupported(version)) {
                throw new UnsupportedOperationException("The provided KeePass database file seems to be from a newer KeePass version which is not supported!");    
            }
        } else if (signaturePart1 == OLD_DATABASE_V1_FILE_SIGNATURE_1_INT && signaturePart2 == OLD_DATABASE_V1_FILE_SIGNATURE_2_INT) {
            throw new UnsupportedOperationException("The provided KeePass database file seems to be from KeePass 1.x which is not supported!");
        } 
        else {
            throw new UnsupportedOperationException("The provided file seems to be no KeePass database file!");
        }
    }

    public  KeePassHeader();
    public  KeePassHeader(ByteGenerator byteGenerator);

}