Package org.apache.poi.poifs.filesystem
Class DocumentInputStream
- java.lang.Object
-
- java.io.InputStream
-
- org.apache.poi.poifs.filesystem.DocumentInputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,LittleEndianInput
public final class DocumentInputStream extends java.io.InputStream implements LittleEndianInput
This class provides methods to read a DocumentEntry managed by aPOIFSFileSystem
instance.
-
-
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 int
available()
void
close()
void
mark(int ignoredReadlimit)
boolean
markSupported()
Tests if this input stream supports the mark and reset methods.int
read()
int
read(byte[] b)
int
read(byte[] b, int off, int len)
byte
readByte()
double
readDouble()
void
readFully(byte[] buf)
void
readFully(byte[] buf, int off, int len)
int
readInt()
long
readLong()
void
readPlain(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 filledshort
readShort()
int
readUByte()
long
readUInt()
int
readUShort()
void
reset()
Repositions this stream to the position at the time the mark() method was last called on this input stream.long
skip(long n)
-
-
-
Constructor Detail
-
DocumentInputStream
public DocumentInputStream(DocumentEntry document) throws java.io.IOException
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
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:
available
in interfaceLittleEndianInput
- Overrides:
available
in classjava.io.InputStream
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.InputStream
-
markSupported
public boolean markSupported()
Tests if this input stream supports the mark and reset methods.- Overrides:
markSupported
in classjava.io.InputStream
- Returns:
true
always
-
mark
public void mark(int ignoredReadlimit)
- Overrides:
mark
in classjava.io.InputStream
-
read
public int read() throws java.io.IOException
- Specified by:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
read
public int read(byte[] b) throws java.io.IOException
- Overrides:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
read
public int read(byte[] b, int off, int len) throws java.io.IOException
- Overrides:
read
in 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:
reset
in classjava.io.InputStream
-
skip
public long skip(long n) throws java.io.IOException
- Overrides:
skip
in classjava.io.InputStream
- Throws:
java.io.IOException
-
readFully
public void readFully(byte[] buf)
- Specified by:
readFully
in interfaceLittleEndianInput
-
readFully
public void readFully(byte[] buf, int off, int len)
- Specified by:
readFully
in interfaceLittleEndianInput
-
readPlain
public void readPlain(byte[] buf, int off, int len)
Description copied from interface:LittleEndianInput
Usually acts the same asLittleEndianInput.readFully(byte[], int, int)
, but for an encrypted stream the raw (unencrypted) data is filled- Specified by:
readPlain
in 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:
readByte
in interfaceLittleEndianInput
-
readDouble
public double readDouble()
- Specified by:
readDouble
in interfaceLittleEndianInput
-
readLong
public long readLong()
- Specified by:
readLong
in interfaceLittleEndianInput
-
readShort
public short readShort()
- Specified by:
readShort
in interfaceLittleEndianInput
-
readInt
public int readInt()
- Specified by:
readInt
in interfaceLittleEndianInput
-
readUInt
public long readUInt()
-
readUShort
public int readUShort()
- Specified by:
readUShort
in interfaceLittleEndianInput
-
readUByte
public int readUByte()
- Specified by:
readUByte
in interfaceLittleEndianInput
-
-