|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.io.Reader org.apache.tika.parser.ParsingReader
public class ParsingReader
Reader for the text content from a given binary stream. This class
uses a background parsing task with a Parser
(AutoDetectParser
by default) to parse the text content from
a given input stream. The BodyContentHandler
class and a pipe
is used to convert the push-based SAX event stream to the pull-based
character stream defined by the Reader
interface.
Field Summary |
---|
Fields inherited from class java.io.Reader |
---|
lock |
Constructor Summary | |
---|---|
ParsingReader(java.io.File file)
Creates a reader for the text content of the given file. |
|
ParsingReader(java.io.InputStream stream)
Creates a reader for the text content of the given binary stream. |
|
ParsingReader(java.io.InputStream stream,
java.lang.String name)
Creates a reader for the text content of the given binary stream with the given name. |
|
ParsingReader(Parser parser,
java.io.InputStream stream,
Metadata metadata)
Deprecated. This method will be removed in Apache Tika 1.0 |
|
ParsingReader(Parser parser,
java.io.InputStream stream,
Metadata metadata,
java.util.concurrent.Executor executor)
Deprecated. This method will be removed in Apache Tika 1.0 |
|
ParsingReader(Parser parser,
java.io.InputStream stream,
Metadata metadata,
ParseContext context)
Creates a reader for the text content of the given binary stream with the given document metadata. |
|
ParsingReader(Parser parser,
java.io.InputStream stream,
Metadata metadata,
ParseContext context,
java.util.concurrent.Executor executor)
Creates a reader for the text content of the given binary stream with the given document metadata. |
Method Summary | |
---|---|
void |
close()
Closes the read end of the pipe. |
int |
read(char[] cbuf,
int off,
int len)
Reads parsed text from the pipe connected to the parsing thread. |
Methods inherited from class java.io.Reader |
---|
mark, markSupported, read, read, read, ready, reset, skip |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ParsingReader(java.io.InputStream stream) throws java.io.IOException
stream
- binary stream
java.io.IOException
- if the document can not be parsedpublic ParsingReader(java.io.InputStream stream, java.lang.String name) throws java.io.IOException
stream
- binary streamname
- document name
java.io.IOException
- if the document can not be parsedpublic ParsingReader(java.io.File file) throws java.io.FileNotFoundException, java.io.IOException
file
- file
java.io.FileNotFoundException
- if the given file does not exist
java.io.IOException
- if the document can not be parsedpublic ParsingReader(Parser parser, java.io.InputStream stream, Metadata metadata, ParseContext context) throws java.io.IOException
The created reader will be responsible for closing the given stream.
The stream and any associated resources will be closed at or before
the time when the close()
method is called on this reader.
parser
- parser instancestream
- binary streammetadata
- document metadata
java.io.IOException
- if the document can not be parsedpublic ParsingReader(Parser parser, java.io.InputStream stream, Metadata metadata, ParseContext context, java.util.concurrent.Executor executor) throws java.io.IOException
Reader
interface.
The created reader will be responsible for closing the given stream.
The stream and any associated resources will be closed at or before
the time when the close()
method is called on this reader.
parser
- parser instancestream
- binary streammetadata
- document metadatacontext
- parsing contextexecutor
- executor for the parsing task
java.io.IOException
- if the document can not be parsedpublic ParsingReader(Parser parser, java.io.InputStream stream, Metadata metadata) throws java.io.IOException
java.io.IOException
public ParsingReader(Parser parser, java.io.InputStream stream, Metadata metadata, java.util.concurrent.Executor executor) throws java.io.IOException
java.io.IOException
Method Detail |
---|
public int read(char[] cbuf, int off, int len) throws java.io.IOException
read
in class java.io.Reader
cbuf
- character bufferoff
- start offset within the bufferlen
- maximum number of characters to read
java.io.IOException
- if the parsing thread has failed or
if for some reason the pipe does not work properlypublic void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in class java.io.Reader
java.io.IOException
- if the pipe can not be closed
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |