code: @SuppressWarnings("resource")
      public void read(byte[] keepassFile) throws IOException {
          SafeInputStream inputStream = new SafeInputStream(new BufferedInputStream(new ByteArrayInputStream(keepassFile)));
          inputStream.skipSafe(VERSION_SIGNATURE_LENGTH); // skip version
          
          if(fileFormatVersion == 0) {
              throw new UnsupportedOperationException("File format version not set! Make sure to call checkVersionSupport before ");
          }
          
          while (true) {
              try {
                  int fieldId = inputStream.read();
                  
                  byte[] fieldLength;
                  if(fileFormatVersion < DATABASE_V4_FILE_VERSION_INT) {
                      fieldLength = new byte[2];
                  }
                  else {
                      fieldLength = new byte[4];
                  }
                  
                  inputStream.readSafe(fieldLength);
  
                  ByteBuffer fieldLengthBuffer = ByteBuffer.wrap(fieldLength);
                  fieldLengthBuffer.order(ByteOrder.LITTLE_ENDIAN);
                  int fieldLengthInt = ByteUtils.toUnsignedInt(fieldLengthBuffer.getShort());
  
                  if (fieldLengthInt > 0) {
                      byte[] data = new byte[fieldLengthInt];
                      inputStream.readSafe(data);
                      setValue(fieldId, data);
                  }
  
                  if (fieldId == 0) {
                      break;
                  }
              } catch (IOException e) {
                  throw new KeePassHeaderUnreadableException("Could not read header input", e);
              }
          }
      }
docs: Initializes the header values from a given byte array.
  
  @param keepassFile
  the byte array to read from
  @throws IOException
  if the header cannot be read