Class DocumentInputStream
java.lang.Object
java.io.InputStream
org.docx4j.org.apache.poi.poifs.filesystem.DocumentInputStream
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,LittleEndianInput
- Direct Known Subclasses:
NDocumentInputStream,ODocumentInputStream
public class DocumentInputStream extends java.io.InputStream implements LittleEndianInput
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
Fields Modifier and Type Field Description protected static intEOFreturned by read operations if we're at end of documentprotected static intSIZE_INTprotected static intSIZE_LONGprotected static intSIZE_SHORT -
Constructor Summary
Constructors Modifier Constructor Description protectedDocumentInputStream()For 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 Type Method Description intavailable()voidclose()voidmark(int ignoredReadlimit)booleanmarkSupported()Tests if this input stream supports the mark and reset methods.intread()intread(byte[] b)intread(byte[] b, int off, int len)bytereadByte()doublereadDouble()voidreadFully(byte[] buf)voidreadFully(byte[] buf, int off, int len)intreadInt()longreadLong()shortreadShort()intreadUByte()longreadUInt()intreadUShort()voidreset()Repositions this stream to the position at the time the mark() method was last called on this input stream.longskip(long n)
-
Field Details
-
EOF
protected static final int EOFreturned by read operations if we're at end of document- See Also:
- Constant Field Values
-
SIZE_SHORT
protected static final int SIZE_SHORT- See Also:
- Constant Field Values
-
SIZE_INT
protected static final int SIZE_INT- See Also:
- Constant Field Values
-
SIZE_LONG
protected static final int SIZE_LONG- See Also:
- Constant Field Values
-
-
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:
java.io.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 classjava.io.InputStream
-
close
public void close()- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.InputStream
-
mark
public void mark(int ignoredReadlimit)- Overrides:
markin classjava.io.InputStream
-
markSupported
public boolean markSupported()Tests if this input stream supports the mark and reset methods.- Overrides:
markSupportedin classjava.io.InputStream- Returns:
truealways
-
read
public int read() throws java.io.IOException- Specified by:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
read
public int read(byte[] b) throws java.io.IOException- Overrides:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
read
public int read(byte[] b, int off, int len) throws java.io.IOException- Overrides:
readin classjava.io.InputStream- Throws:
java.io.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 classjava.io.InputStream
-
skip
public long skip(long n) throws java.io.IOException- Overrides:
skipin classjava.io.InputStream- Throws:
java.io.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()
-