Class DocumentInputStream
java.lang.Object
java.io.InputStream
org.docx4j.org.apache.poi.poifs.filesystem.DocumentInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable,LittleEndianInput
- Direct Known Subclasses:
NDocumentInputStream,ODocumentInputStream
This class provides methods to read a DocumentEntry managed by a
POIFSFileSystem or NPOIFSFileSystem instance.
It creates the appropriate one, and delegates, allowing us to
work transparently with the two.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final intreturned by read operations if we're at end of documentprotected static final intprotected static final intprotected static final int -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedFor use by downstream implementationsDocumentInputStream(DocumentEntry document) Create an InputStream from the specified DocumentEntryDocumentInputStream(NPOIFSDocument document) Create an InputStream from the specified DocumentDocumentInputStream(OPOIFSDocument document) Create an InputStream from the specified Document -
Method Summary
Modifier and TypeMethodDescriptionintvoidclose()voidmark(int ignoredReadlimit) booleanTests if this input stream supports the mark and reset methods.intread()intread(byte[] b) intread(byte[] b, int off, int len) bytereadByte()doublevoidreadFully(byte[] buf) voidreadFully(byte[] buf, int off, int len) intreadInt()longreadLong()shortintlongreadUInt()intvoidreset()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 java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Field Details
-
EOF
protected static final int EOFreturned by read operations if we're at end of document- See Also:
-
SIZE_SHORT
protected static final int SIZE_SHORT- See Also:
-
SIZE_INT
protected static final int SIZE_INT- See Also:
-
SIZE_LONG
protected static final int SIZE_LONG- See Also:
-
-
Constructor Details
-
DocumentInputStream
protected DocumentInputStream()For use by downstream implementations -
DocumentInputStream
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?)
-
DocumentInputStream
Create an InputStream from the specified Document- Parameters:
document- the Document to be read
-
DocumentInputStream
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 classInputStream
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream
-
mark
public void mark(int ignoredReadlimit) - Overrides:
markin classInputStream
-
markSupported
public boolean markSupported()Tests if this input stream supports the mark and reset methods.- Overrides:
markSupportedin classInputStream- Returns:
truealways
-
read
- Specified by:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- 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 classInputStream
-
skip
- Overrides:
skipin classInputStream- Throws:
IOException
-
readByte
public byte readByte()- Specified by:
readBytein interfaceLittleEndianInput
-
readDouble
public double readDouble()- Specified by:
readDoublein interfaceLittleEndianInput
-
readShort
public short readShort()- Specified by:
readShortin interfaceLittleEndianInput
-
readFully
public void readFully(byte[] buf) - Specified by:
readFullyin interfaceLittleEndianInput
-
readFully
public void readFully(byte[] buf, int off, int len) - Specified by:
readFullyin interfaceLittleEndianInput
-
readLong
public long readLong()- Specified by:
readLongin interfaceLittleEndianInput
-
readInt
public int readInt()- Specified by:
readIntin interfaceLittleEndianInput
-
readUShort
public int readUShort()- Specified by:
readUShortin interfaceLittleEndianInput
-
readUByte
public int readUByte()- Specified by:
readUBytein interfaceLittleEndianInput
-
readUInt
public long readUInt()
-