org.apache.poi.util
Class RLEDecompressingInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by org.apache.poi.util.RLEDecompressingInputStream
All Implemented Interfaces:
java.io.Closeable

public class RLEDecompressingInputStream
extends java.io.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
RLEDecompressingInputStream(java.io.InputStream in)
          Creates a new wrapper RLE Decompression InputStream.
 
Method Summary
 int available()
           
 void close()
           
static byte[] decompress(byte[] compressed)
           
static byte[] decompress(byte[] compressed, int offset, int length)
           
 int read()
           
 int read(byte[] b)
           
 int read(byte[] b, int off, int l)
           
 int readInt()
          Convenience method for read a 4-bytes int in little endian encoding.
 int readShort()
          Convenience method for read a 2-bytes short in little endian encoding.
 long skip(long n)
           
 
Methods inherited from class java.io.InputStream
mark, markSupported, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RLEDecompressingInputStream

public RLEDecompressingInputStream(java.io.InputStream in)
                            throws java.io.IOException
Creates a new wrapper RLE Decompression InputStream.

Parameters:
in - The stream to wrap with the RLE Decompression
Throws:
java.io.IOException
Method Detail

read

public int read()
         throws java.io.IOException
Specified by:
read in class java.io.InputStream
Throws:
java.io.IOException

read

public int read(byte[] b)
         throws java.io.IOException
Overrides:
read in class java.io.InputStream
Throws:
java.io.IOException

read

public int read(byte[] b,
                int off,
                int l)
         throws java.io.IOException
Overrides:
read in class java.io.InputStream
Throws:
java.io.IOException

skip

public long skip(long n)
          throws java.io.IOException
Overrides:
skip in class java.io.InputStream
Throws:
java.io.IOException

available

public int available()
Overrides:
available in class java.io.InputStream

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.InputStream
Throws:
java.io.IOException

readShort

public int readShort()
              throws java.io.IOException
Convenience 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:
java.io.IOException

readInt

public int readInt()
            throws java.io.IOException
Convenience 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:
java.io.IOException

decompress

public static byte[] decompress(byte[] compressed)
                         throws java.io.IOException
Throws:
java.io.IOException

decompress

public static byte[] decompress(byte[] compressed,
                                int offset,
                                int length)
                         throws java.io.IOException
Throws:
java.io.IOException