Package org.apache.poi.util
Class RLEDecompressingInputStream
- java.lang.Object
-
- java.io.InputStream
-
- org.apache.poi.util.RLEDecompressingInputStream
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class RLEDecompressingInputStream extends InputStream
Wrapper of InputStream which provides Run Length Encoding (RLE) decompression on the fly. Uses MS-OVBA decompression algorithm. See http://download.microsoft.com/download/2/4/8/24862317-78F0-4C4B-B355-C7B2C1D997DB/[MS-OVBA].pdf
-
-
Constructor Summary
Constructors Constructor Description RLEDecompressingInputStream(InputStream in)Creates a new wrapper RLE Decompression InputStream.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()voidclose()static byte[]decompress(byte[] compressed)static byte[]decompress(byte[] compressed, int offset, int length)intread()intread(byte[] b)intread(byte[] b, int off, int l)intreadInt()Convenience method for read a 4-bytes int in little endian encoding.intreadShort()Convenience method for read a 2-bytes short in little endian encoding.longskip(long n)-
Methods inherited from class java.io.InputStream
mark, markSupported, nullInputStream, readAllBytes, readNBytes, readNBytes, reset, transferTo
-
-
-
-
Constructor Detail
-
RLEDecompressingInputStream
public RLEDecompressingInputStream(InputStream in) throws IOException
Creates a new wrapper RLE Decompression InputStream.- Parameters:
in- The stream to wrap with the RLE Decompression- Throws:
IOException
-
-
Method Detail
-
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 l) throws IOException- Overrides:
readin classInputStream- Throws:
IOException
-
skip
public long skip(long n) throws IOException- Overrides:
skipin classInputStream- Throws:
IOException
-
available
public int available()
- Overrides:
availablein classInputStream
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
readShort
public int readShort() throws IOExceptionConvenience method for read a 2-bytes short in little endian encoding.- Returns:
- short value from the stream, -1 if end of stream is reached
- Throws:
IOException
-
readInt
public int readInt() throws IOExceptionConvenience method for read a 4-bytes int in little endian encoding.- Returns:
- integer value from the stream, -1 if end of stream is reached
- Throws:
IOException
-
decompress
public static byte[] decompress(byte[] compressed) throws IOException- Throws:
IOException
-
decompress
public static byte[] decompress(byte[] compressed, int offset, int length) throws IOException- Throws:
IOException
-
-