Package org.jacoco.core.internal
Class ContentTypeDetector
- java.lang.Object
-
- org.jacoco.core.internal.ContentTypeDetector
-
public class ContentTypeDetector extends java.lang.Object
Detector for content types of binary streams based on a magic headers.
-
-
Field Summary
Fields Modifier and Type Field Description static int
CLASSFILE
File type Java classstatic int
GZFILE
File type GZIP compressed Datastatic int
PACK200FILE
File type Pack200 archivestatic int
UNKNOWN
Unknown file typestatic int
ZIPFILE
File type ZIP archive
-
Constructor Summary
Constructors Constructor Description ContentTypeDetector(java.io.InputStream in)
Creates a new detector based on the given input.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.io.InputStream
getInputStream()
Returns an input stream instance to read the complete content (including the header) of the underlying stream.int
getType()
Returns the detected file type.
-
-
-
Field Detail
-
UNKNOWN
public static final int UNKNOWN
Unknown file type- See Also:
- Constant Field Values
-
CLASSFILE
public static final int CLASSFILE
File type Java class- See Also:
- Constant Field Values
-
ZIPFILE
public static final int ZIPFILE
File type ZIP archive- See Also:
- Constant Field Values
-
GZFILE
public static final int GZFILE
File type GZIP compressed Data- See Also:
- Constant Field Values
-
PACK200FILE
public static final int PACK200FILE
File type Pack200 archive- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ContentTypeDetector
public ContentTypeDetector(java.io.InputStream in) throws java.io.IOException
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:
java.io.IOException
- if the stream can't be read
-
-
Method Detail
-
getInputStream
public java.io.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
-
-