|
||||||||||
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(File file)
Creates a reader for the text content of the given file. |
|
ParsingReader(InputStream stream)
Creates a reader for the text content of the given binary stream. |
|
ParsingReader(InputStream stream,
String name)
Creates a reader for the text content of the given binary stream with the given name. |
|
ParsingReader(Parser parser,
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,
InputStream stream,
Metadata metadata,
ParseContext context,
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(InputStream stream) throws IOException
stream
- binary stream
IOException
- if the document can not be parsedpublic ParsingReader(InputStream stream, String name) throws IOException
stream
- binary streamname
- document name
IOException
- if the document can not be parsedpublic ParsingReader(File file) throws FileNotFoundException, IOException
file
- file
FileNotFoundException
- if the given file does not exist
IOException
- if the document can not be parsedpublic ParsingReader(Parser parser, InputStream stream, Metadata metadata, ParseContext context) throws 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
IOException
- if the document can not be parsedpublic ParsingReader(Parser parser, InputStream stream, Metadata metadata, ParseContext context, Executor executor) throws 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
IOException
- if the document can not be parsedMethod Detail |
---|
public int read(char[] cbuf, int off, int len) throws IOException
read
in class Reader
cbuf
- character bufferoff
- start offset within the bufferlen
- maximum number of characters to read
IOException
- if the parsing thread has failed or
if for some reason the pipe does not work properlypublic void close() throws IOException
close
in interface Closeable
close
in class Reader
IOException
- if the pipe can not be closed
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |