Class ContentTypeDetectingInputStreamWrapper

java.lang.Object
java.io.InputStream
java.io.FilterInputStream
java.io.BufferedInputStream
org.xhtmlrenderer.util.ContentTypeDetectingInputStreamWrapper
All Implemented Interfaces:
Closeable, AutoCloseable

public class ContentTypeDetectingInputStreamWrapper extends BufferedInputStream
This class wraps an input stream and detects if it contains certain content using "magic numbers". ...

currently only pdf detection is implemented

  • Field Details

    • MAX_MAGIC_BYTES

      protected static final int MAX_MAGIC_BYTES
      See Also:
    • firstBytes

      private final byte[] firstBytes
    • MAGIC_BYTES_PDF

      private static final byte[] MAGIC_BYTES_PDF
  • Constructor Details

  • Method Details

    • streamStartsWithMagicBytes

      private boolean streamStartsWithMagicBytes(byte[] bytes)
    • isPdf

      public boolean isPdf()