docs: public void extract(@NotNull final InputStream inputStream, @NotNull final Metadata metadata) throws IOException
      {
          RandomAccessStreamReader reader = new RandomAccessStreamReader(inputStream);
          EpsDirectory directory = new EpsDirectory();
          metadata.addDirectory(directory);
  
          /*
           * 0xC5D0D3C6 signifies an EPS Header block which contains 32-bytes of basic information
           *
           * 0x25215053 (%!PS) signifies an EPS File and leads straight into the PostScript
           */
          switch (reader.getInt32(0)) {
              case 0xC5D0D3C6:
                  reader.setMotorolaByteOrder(false);
                  int postScriptOffset = reader.getInt32(4);
                  int postScriptLength = reader.getInt32(8);
                  int wmfOffset = reader.getInt32(12);
                  int wmfSize = reader.getInt32(16);
                  int tifOffset = reader.getInt32(20);
                  int tifSize = reader.getInt32(24);
                  //int checkSum = reader.getInt32(28);
  
                  // Get Tiff/WMF preview data if applicable
                  if (tifSize != 0) {
                      directory.setInt(EpsDirectory.TAG_TIFF_PREVIEW_SIZE, tifSize);
                      directory.setInt(EpsDirectory.TAG_TIFF_PREVIEW_OFFSET, tifOffset);
                      // Get Tiff metadata
                      try {
                          ByteArrayReader byteArrayReader = new ByteArrayReader(reader.getBytes(tifOffset, tifSize));
                          new TiffReader().processTiff(byteArrayReader, new PhotoshopTiffHandler(metadata, null), 0);
                      } catch (TiffProcessingException ex) {
                          directory.addError("Unable to process TIFF data: " + ex.getMessage());
                      }
                  } else if (wmfSize != 0) {
                      directory.setInt(EpsDirectory.TAG_WMF_PREVIEW_SIZE, wmfSize);
                      directory.setInt(EpsDirectory.TAG_WMF_PREVIEW_OFFSET, wmfOffset);
                  }
  
                  // TODO avoid allocating byte array here -- read directly from InputStream
                  extract(directory, metadata, new SequentialByteArrayReader(reader.getBytes(postScriptOffset, postScriptLength)));
                  break;
              case 0x25215053:
                  inputStream.reset();
                  extract(directory, metadata, new StreamReader(inputStream));
                  break;
              default:
                  directory.addError("File type not supported.");
                  break;
          }
      }