com.sun.jimi.core.encoder.pcx
Class RLEOutputStreamForPCX
java.lang.Object
|
+--java.io.OutputStream
|
+--com.sun.jimi.core.encoder.pcx.RLEOutputStreamForPCX
- public class RLEOutputStreamForPCX
- extends java.io.OutputStream
OutputStream wrapper for writing PCX-style RLE compressed data (1 / 2 byte run code)
Field Summary |
protected boolean |
endOfLine
Whethere or not the end of scan line has been reached |
protected static byte |
ONEFLAG
|
protected java.io.OutputStream |
out_
Stream to write to. |
protected int |
runCount_
Number of occurances of the value in the run. |
protected byte |
runValue_
Value currently being used in a run. |
protected static byte |
ZEROFLAG
|
Constructor Summary |
RLEOutputStreamForPCX(java.io.OutputStream out)
Constructs an RLE-compressed wrapper for a given OutputStream. |
Method Summary |
protected void |
compressBytes(byte[] data,
int offset,
int len)
Compresses a byte array and writes it to the stream. |
void |
flush()
|
void |
write(byte[] data)
Compresses a byte array and writes it to the stream. |
void |
write(byte[] data,
int offset,
int length)
Compresses a byte array and writes it to the stream. |
void |
write(int value)
Compresses a byte into the stream. |
protected void |
writeRun()
|
protected void |
writeRun(int run_count,
byte value)
|
Methods inherited from class java.io.OutputStream |
close |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
ONEFLAG
protected static final byte ONEFLAG
ZEROFLAG
protected static final byte ZEROFLAG
out_
protected java.io.OutputStream out_
- Stream to write to.
runValue_
protected byte runValue_
- Value currently being used in a run.
endOfLine
protected boolean endOfLine
- Whethere or not the end of scan line has been reached
runCount_
protected int runCount_
- Number of occurances of the value in the run.
RLEOutputStreamForPCX
public RLEOutputStreamForPCX(java.io.OutputStream out)
- Constructs an RLE-compressed wrapper for a given OutputStream.
- Parameters:
out
- The underlying stream to write to.
compressBytes
protected void compressBytes(byte[] data,
int offset,
int len)
throws java.io.IOException
- Compresses a byte array and writes it to the stream.
- Parameters:
data
- The data to compress.
write
public void write(byte[] data)
throws java.io.IOException
- Compresses a byte array and writes it to the stream.
- Parameters:
data
- The data to compress.- Overrides:
- write in class java.io.OutputStream
write
public void write(byte[] data,
int offset,
int length)
throws java.io.IOException
- Compresses a byte array and writes it to the stream.
- Parameters:
data
- The data to compress.offset
- The offset in the data to start from.length
- The length of data to write.- Overrides:
- write in class java.io.OutputStream
write
public void write(int value)
throws java.io.IOException
- Compresses a byte into the stream. This method is not optimal, use of
the array-based write where possible is encouraged.
- Parameters:
value
- The data to compress.- Overrides:
- write in class java.io.OutputStream
flush
public void flush()
throws java.io.IOException
- Overrides:
- flush in class java.io.OutputStream
writeRun
protected void writeRun(int run_count,
byte value)
throws java.io.IOException
writeRun
protected void writeRun()
throws java.io.IOException