Class ContentTypeDetector
java.lang.Object
org.jacoco.core.internal.ContentTypeDetector
Detector for content types of binary streams based on a magic headers.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intstatic final intFile type Java classstatic final intFile type GZIP compressed Dataprivate final InputStreamstatic final intFile type Pack200 archiveprivate final intstatic final intUnknown file typestatic final intFile type ZIP archive -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new detector based on the given input. -
Method Summary
Modifier and TypeMethodDescriptionprivate static intReturns an input stream instance to read the complete content (including the header) of the underlying stream.intgetType()Returns the detected file type.private static intreadInt(InputStream in)
-
Field Details
-
UNKNOWN
public static final int UNKNOWNUnknown file type- See Also:
-
CLASSFILE
public static final int CLASSFILEFile type Java class- See Also:
-
ZIPFILE
public static final int ZIPFILEFile type ZIP archive- See Also:
-
GZFILE
public static final int GZFILEFile type GZIP compressed Data- See Also:
-
PACK200FILE
public static final int PACK200FILEFile type Pack200 archive- See Also:
-
BUFFER_SIZE
private static final int BUFFER_SIZE- See Also:
-
in
-
type
private final int type
-
-
Constructor Details
-
ContentTypeDetector
Creates a new detector based on the given input. To process the complete original input afterwards use the stream returned bygetInputStream().- Parameters:
in- input to read the header from- Throws:
IOException- if the stream can't be read
-
-
Method Details
-
determineType
- Throws:
IOException
-
readInt
- Throws:
IOException
-
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
-