picture.io
Class BWTInputStream
java.lang.Object
|
+--java.io.InputStream
|
+--java.io.FilterInputStream
|
+--picture.io.BWTInputStream
- public class BWTInputStream
- extends java.io.FilterInputStream
Filtering input stream which transforms its data with the inverse
Burrows-Wheeler Transformation. For more information see M.
Burrows and D. J. Wheeler: A Block-sorting Lossless Data
Compression Algorithm.
This implementation is based on ideas of c source
code from Mark Nelson.
Fields inherited from class java.io.FilterInputStream |
in |
Method Summary |
int |
available()
|
protected void |
bwtInverseTransform(byte[] b,
int first)
Do the real work ... |
void |
close()
Closes the underlying input stream and deletes own buffer. |
static void |
main(java.lang.String[] args)
|
void |
mark(int readlimit)
Do nothing. |
boolean |
markSupported()
|
int |
read()
Reads and transforms a byte from the underlying output
stream. |
int |
read(byte[] b,
int off,
int len)
Reads and transforms a byte array from the underlying output
stream. |
void |
reset()
Do nothing. |
long |
skip(long n)
Skips bytes. |
Methods inherited from class java.io.FilterInputStream |
read |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BWTInputStream
public BWTInputStream(java.io.InputStream in)
bwtInverseTransform
protected void bwtInverseTransform(byte[] b,
int first)
throws java.io.IOException
- Do the real work ...
read
public int read()
throws java.io.IOException
- Reads and transforms a byte from the underlying output
stream. Therefore it must read the whole array which was
transformed.
- Overrides:
read
in class java.io.FilterInputStream
- Returns:
- tranformed byte or -1 for end of file
- Throws:
java.io.IOException
-
read
public int read(byte[] b,
int off,
int len)
throws java.io.IOException
- Reads and transforms a byte array from the underlying output
stream. Therefore it must read the whole array which was
transformed.
- Overrides:
read
in class java.io.FilterInputStream
- Parameters:
b
- where to write the bytes tooff
- starting offsetlen
- how many bytes to read- Returns:
- number of bytes bytes actually read
- Throws:
java.io.IOException
-
available
public int available()
throws java.io.IOException
- Overrides:
available
in class java.io.FilterInputStream
- Returns:
- 0
close
public void close()
throws java.io.IOException
- Closes the underlying input stream and deletes own buffer.
- Overrides:
close
in class java.io.FilterInputStream
mark
public void mark(int readlimit)
- Do nothing.
- Overrides:
mark
in class java.io.FilterInputStream
reset
public void reset()
throws java.io.IOException
- Do nothing.
- Overrides:
reset
in class java.io.FilterInputStream
markSupported
public boolean markSupported()
- Overrides:
markSupported
in class java.io.FilterInputStream
- Returns:
- false
skip
public long skip(long n)
throws java.io.IOException
- Skips bytes.
- Overrides:
skip
in class java.io.FilterInputStream
- Parameters:
n
- how many bytes to skip.- Returns:
- number of bytes actually skipped
- Throws:
java.io.IOException
-
main
public static void main(java.lang.String[] args)
throws java.io.IOException