Class NDocumentInputStream
java.lang.Object
java.io.InputStream
org.docx4j.org.apache.poi.poifs.filesystem.DocumentInputStream
org.docx4j.org.apache.poi.poifs.filesystem.NDocumentInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable,LittleEndianInput
This class provides methods to read a DocumentEntry managed by a
NPOIFSFileSystem instance.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ByteBufferprivate booleanhave we been closed?private intcurrent block countprivate intcurrent offset into the Documentprivate Iterator<ByteBuffer>private NPOIFSDocumentthe actual Documentprivate intthe Document's sizeprivate intcurrent marked offset into the Document (used by mark and reset)private intand the block count for itFields inherited from class org.docx4j.org.apache.poi.poifs.filesystem.DocumentInputStream
EOF, SIZE_INT, SIZE_LONG, SIZE_SHORT -
Constructor Summary
ConstructorsConstructorDescriptionNDocumentInputStream(DocumentEntry document) Create an InputStream from the specified DocumentEntryNDocumentInputStream(NPOIFSDocument document) Create an InputStream from the specified Document -
Method Summary
Modifier and TypeMethodDescriptionprivate booleanatEOD()intprivate voidcheckAvaliable(int requestedSize) voidclose()private voidvoidmark(int ignoredReadlimit) intread()intread(byte[] b, int off, int len) bytereadByte()doublevoidreadFully(byte[] buf, int off, int len) intreadInt()longreadLong()shortintintvoidreset()Repositions this stream to the position at the time the mark() method was last called on this input stream.longskip(long n) Methods inherited from class org.docx4j.org.apache.poi.poifs.filesystem.DocumentInputStream
markSupported, read, readFully, readUIntMethods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Field Details
-
_current_offset
private int _current_offsetcurrent offset into the Document -
_current_block_count
private int _current_block_countcurrent block count -
_marked_offset
private int _marked_offsetcurrent marked offset into the Document (used by mark and reset) -
_marked_offset_count
private int _marked_offset_countand the block count for it -
_document_size
private int _document_sizethe Document's size -
_closed
private boolean _closedhave we been closed? -
_document
the actual Document -
_data
-
_buffer
-
-
Constructor Details
-
NDocumentInputStream
Create an InputStream from the specified DocumentEntry- Parameters:
document- the DocumentEntry to be read- Throws:
IOException- if the DocumentEntry cannot be opened (like, maybe it has been deleted?)
-
NDocumentInputStream
Create an InputStream from the specified Document- Parameters:
document- the Document to be read
-
-
Method Details
-
available
public int available()- Specified by:
availablein interfaceLittleEndianInput- Overrides:
availablein classDocumentInputStream
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classDocumentInputStream
-
mark
public void mark(int ignoredReadlimit) - Overrides:
markin classDocumentInputStream
-
read
- Overrides:
readin classDocumentInputStream- Throws:
IOException
-
read
- Overrides:
readin classDocumentInputStream- Throws:
IOException
-
reset
public void reset()Repositions this stream to the position at the time the mark() method was last called on this input stream. If mark() has not been called this method repositions the stream to its beginning.- Overrides:
resetin classDocumentInputStream
-
skip
- Overrides:
skipin classDocumentInputStream- Throws:
IOException
-
dieIfClosed
- Throws:
IOException
-
atEOD
private boolean atEOD() -
checkAvaliable
private void checkAvaliable(int requestedSize) -
readFully
public void readFully(byte[] buf, int off, int len) - Specified by:
readFullyin interfaceLittleEndianInput- Overrides:
readFullyin classDocumentInputStream
-
readByte
public byte readByte()- Specified by:
readBytein interfaceLittleEndianInput- Overrides:
readBytein classDocumentInputStream
-
readDouble
public double readDouble()- Specified by:
readDoublein interfaceLittleEndianInput- Overrides:
readDoublein classDocumentInputStream
-
readLong
public long readLong()- Specified by:
readLongin interfaceLittleEndianInput- Overrides:
readLongin classDocumentInputStream
-
readShort
public short readShort()- Specified by:
readShortin interfaceLittleEndianInput- Overrides:
readShortin classDocumentInputStream
-
readInt
public int readInt()- Specified by:
readIntin interfaceLittleEndianInput- Overrides:
readIntin classDocumentInputStream
-
readUShort
public int readUShort()- Specified by:
readUShortin interfaceLittleEndianInput- Overrides:
readUShortin classDocumentInputStream
-
readUByte
public int readUByte()- Specified by:
readUBytein interfaceLittleEndianInput- Overrides:
readUBytein classDocumentInputStream
-