Package org.jacoco.core.internal
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 int
static final int
File type Java classstatic final int
File type GZIP compressed Dataprivate final InputStream
static final int
File type Pack200 archiveprivate final int
static final int
Unknown file typestatic final int
File type ZIP archive -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new detector based on the given input. -
Method Summary
Modifier and TypeMethodDescriptionprivate static int
Returns an input stream instance to read the complete content (including the header) of the underlying stream.int
getType()
Returns the detected file type.private static int
readInt
(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
-