org.jacoco.core.internal

## 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 Summary

Fields
`static int` `CLASSFILE` File type Java class
`static int` `GZFILE` File type GZIP compressed Data
`static int` `PACK200FILE` File type Pack200 archive
`static int` `UNKNOWN` Unknown file type
`static int` `ZIPFILE` File type ZIP archive

### Constructor Summary

Constructors
Constructor and Description
`ContentTypeDetector(InputStream in)` Creates a new detector based on the given input.

### Method Summary

All Methods Instance Methods Concrete Methods
`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.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### 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(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 Detail

#### 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