Input stream with extended capabilities. The purpose of this class is
to allow files and other resources and information to be associated with
the InputStream instance passed through the
Parser interface and other similar APIs.

TikaInputStream instances can be created using the various static
get() factory methods. Most of these methods take an optional
Metadata argument that is then filled with the available input
metadata from the given resource. The created TikaInputStream instance
keeps track of the original resource used to create it, while behaving
otherwise just like a normal, buffered InputStream.
A TikaInputStream instance is also guaranteed to support the
mark(int) feature.

Code that wants to access the underlying file or other resources
associated with a TikaInputStream should first use the
get(InputStream) factory method to cast or wrap a given
InputStream into a TikaInputStream instance.

get

Note that the result set containing the BLOB may need to be kept open
until the returned TikaInputStream has been processed and closed.
You must also always explicitly close the returned stream as in
some cases it may end up writing the blob data to a temporary file.

get

Creates a TikaInputStream from the given database BLOB. The BLOB
length (if available) is stored as input metadata in the given
metadata instance.

Note that the result set containing the BLOB may need to be kept open
until the returned TikaInputStream has been processed and closed.
You must also always explicitly close the returned stream as in
some cases it may end up writing the blob data to a temporary file.

peek

Fills the given buffer with upcoming bytes from this stream without
advancing the current stream position. The buffer is filled up unless
the end of stream is encountered before that. This method will block
if not enough bytes are immediately available.

getFileChannel

hasLength

getLength

Returns the length (in bytes) of this stream. Note that if the length
was not available when this stream was instantiated, then this method
will use the getFile() method to buffer the entire stream to
a temporary file in order to calculate the stream length. This case
will only work if the stream has not yet been consumed.