Class ContentTypeDetector

java.lang.Object
org.jacoco.core.internal.ContentTypeDetector

public class ContentTypeDetector extends Object
Detector for content types of binary streams based on a magic headers.
  • Field Details

  • Constructor Details

    • ContentTypeDetector

      public ContentTypeDetector(InputStream in) throws IOException
      Creates a new detector based on the given input. To process the complete original input afterwards use the stream returned by getInputStream().
      Parameters:
      in - input to read the header from
      Throws:
      IOException - if the stream can't be read
  • Method Details

    • determineType

      private static int determineType(InputStream in) throws IOException
      Throws:
      IOException
    • readInt

      private static int readInt(InputStream in) throws IOException
      Throws:
      IOException
    • getInputStream

      public InputStream getInputStream()
      Returns an input stream instance to read the complete content (including the header) of the underlying stream.
      Returns:
      input stream containing the complete content
    • getType

      public int getType()
      Returns the detected file type.
      Returns:
      file type