Package org.apache.poi.poifs.filesystem
Class DocumentInputStream
- java.lang.Object
-
- java.io.InputStream
-
- org.apache.poi.poifs.filesystem.DocumentInputStream
-
- All Implemented Interfaces:
Closeable,AutoCloseable,LittleEndianInput
public final class DocumentInputStream extends InputStream implements LittleEndianInput
This class provides methods to read a DocumentEntry managed by aPOIFSFileSysteminstance.
-
-
Constructor Summary
Constructors Constructor Description DocumentInputStream(DocumentEntry document)Create an InputStream from the specified DocumentEntryDocumentInputStream(POIFSDocument document)Create an InputStream from the specified Document
-
Method Summary
All Methods Instance Methods Concrete Methods 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()voidreadPlain(byte[] buf, int off, int len)Usually acts the same asLittleEndianInput.readFully(byte[], int, int), but for an encrypted stream the raw (unencrypted) data is filledshortreadShort()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)-
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
-
-
-
-
Constructor Detail
-
DocumentInputStream
public DocumentInputStream(DocumentEntry document) throws IOException
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
public DocumentInputStream(POIFSDocument document)
Create an InputStream from the specified Document- Parameters:
document- the Document to be read
-
-
Method Detail
-
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
-
markSupported
public boolean markSupported()
Tests if this input stream supports the mark and reset methods.- Overrides:
markSupportedin classInputStream- Returns:
truealways
-
mark
public void mark(int ignoredReadlimit)
- Overrides:
markin classInputStream
-
read
public int read() throws IOException- Specified by:
readin classInputStream- Throws:
IOException
-
read
public int read(byte[] b) throws IOException- Overrides:
readin classInputStream- Throws:
IOException
-
read
public int read(byte[] b, int off, int len) throws IOException- 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
public long skip(long n) throws IOException- Overrides:
skipin classInputStream- Throws:
IOException
-
readFully
public void readFully(byte[] buf)
- Specified by:
readFullyin interfaceLittleEndianInput
-
readFully
public void readFully(byte[] buf, int off, int len)- Specified by:
readFullyin interfaceLittleEndianInput
-
readPlain
public void readPlain(byte[] buf, int off, int len)Description copied from interface:LittleEndianInputUsually acts the same asLittleEndianInput.readFully(byte[], int, int), but for an encrypted stream the raw (unencrypted) data is filled- Specified by:
readPlainin interfaceLittleEndianInput- Parameters:
buf- the byte array to receive the bytesoff- the start offset into the byte arraylen- the amount of bytes to fill
-
readByte
public byte readByte()
- Specified by:
readBytein interfaceLittleEndianInput
-
readDouble
public double readDouble()
- Specified by:
readDoublein interfaceLittleEndianInput
-
readLong
public long readLong()
- Specified by:
readLongin interfaceLittleEndianInput
-
readShort
public short readShort()
- Specified by:
readShortin interfaceLittleEndianInput
-
readInt
public int readInt()
- Specified by:
readIntin interfaceLittleEndianInput
-
readUInt
public long readUInt()
-
readUShort
public int readUShort()
- Specified by:
readUShortin interfaceLittleEndianInput
-
readUByte
public int readUByte()
- Specified by:
readUBytein interfaceLittleEndianInput
-
-