Class RTFPictStreamParser
java.lang.Object
org.apache.tika.parser.microsoft.rtf.jflex.RTFPictStreamParser
- All Implemented Interfaces:
Closeable,AutoCloseable
Streams decoded bytes from an RTF
\pict group to a temp file.
Pict data is raw image bytes (after hex-pair decoding). There is no
header to parse -- bytes are written directly to a temp file. On
onComplete(Metadata), a TikaInputStream is returned
whose close will clean up the temp file via TemporaryResources.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()longReturns the number of bytes written so far.voidonByte(int b) Receive a single decoded byte from the pict hex stream.onComplete(Metadata metadata) Called when the pict group closes.
-
Constructor Details
-
RTFPictStreamParser
- Parameters:
maxBytes- maximum number of bytes to accept (-1 for unlimited)- Throws:
IOException
-
-
Method Details
-
onByte
Receive a single decoded byte from the pict hex stream.- Throws:
IOExceptionTikaException
-
onComplete
Called when the pict group closes. Returns a TikaInputStream backed by the temp file. The caller owns the TikaInputStream -- closing it will delete the temp file.- Returns:
- a TikaInputStream, or null if no bytes were written
- Throws:
IOException
-
getBytesWritten
public long getBytesWritten()Returns the number of bytes written so far. -
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-