fr.up7.info
Class RLEInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by fr.up7.info.RLEInputStream
All Implemented Interfaces:
Closeable

public class RLEInputStream
extends FilterInputStream

A RLEInputStream implements a stream filter to read compressed data using a RLE format. The format is such that any too long running subsequence of the same single letter in the original data is encoded as the length of the run and the letter. As aaaabbdeaaa could simply be encoded as *4abbde*3a.

Since:
1.4
Version:
0.1 (10/2005)
Author:
Jean-Baptiste Yunès
See Also:
FilterInputStream

Field Summary
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
RLEInputStream(InputStream is)
          Constructs a decompressing input stream from a given input stream.
 
Method Summary
 void close()
          Closes the stream.
 void mark(int limit)
          Actually not supported.
 boolean markSupported()
          Actually not supported.
 long offset()
          Gives the number of uncompressed bytes already read.
 int read()
          Reads a byte of uncompressed data.
 void reset()
          Actually not supported.
 
Methods inherited from class java.io.FilterInputStream
available, read, read, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RLEInputStream

public RLEInputStream(InputStream is)
               throws fr.up7.info.RLEHeaderException
Constructs a decompressing input stream from a given input stream.

Parameters:
is - the underlying compressed data input stream.
Throws:
RLEMissingHeaderException - if no header is found in the file
RLEUnknownHeaderException - if an unknown header is found.
fr.up7.info.RLEHeaderException
Method Detail

markSupported

public boolean markSupported()
Actually not supported.

Overrides:
markSupported in class FilterInputStream
Returns:
false
See Also:
mark(int), reset()

mark

public void mark(int limit)
Actually not supported.

Overrides:
mark in class FilterInputStream
See Also:
markSupported()

reset

public void reset()
           throws IOException
Actually not supported.

Overrides:
reset in class FilterInputStream
Throws:
IOException - each time that function is called.
See Also:
markSupported()

read

public int read()
         throws IOException
Reads a byte of uncompressed data. This method blocks until enough input is available for uncompressing more data.

Overrides:
read in class FilterInputStream
Returns:
the next byte of uncompressed data.
Throws:
IOException - if an I/O error has occured.
See Also:
FilterInputStream.in

close

public void close()
           throws IOException
Closes the stream.

Specified by:
close in interface Closeable
Overrides:
close in class FilterInputStream
Throws:
IOException - if an I/O error has occured.
See Also:
FilterInputStream.in

offset

public long offset()
Gives the number of uncompressed bytes already read.

Returns:
the number of bytes read.