Package org.apache.xmlgraphics.util.io
Class ASCII85OutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.FilterOutputStream
-
- org.apache.xmlgraphics.util.io.ASCII85OutputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.Flushable
,java.lang.AutoCloseable
,ASCII85Constants
,Finalizable
public class ASCII85OutputStream extends java.io.FilterOutputStream implements ASCII85Constants, Finalizable
This class applies a ASCII85 encoding to the stream.- Version:
- $Id$
-
-
Constructor Summary
Constructors Constructor Description ASCII85OutputStream(java.io.OutputStream out)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
checkedWrite(byte[] buf)
private void
checkedWrite(byte[] buf, boolean nosplit)
private void
checkedWrite(byte[] buf, int len)
private void
checkedWrite(byte[] buf, int len, boolean nosplit)
void
close()
private byte[]
convertWord(long word)
This converts a 32 bit value (4 bytes) into 5 bytes using base 85.void
finalizeStream()
This method can be called instead of close() on a subclass of FilteredOutputStream when a final marker has to be written to the target stream, but close() cannot be called.void
write(int b)
-
-
-
Field Detail
-
DEBUG
private static final boolean DEBUG
- See Also:
- Constant Field Values
-
pos
private int pos
-
buffer
private long buffer
-
posinline
private int posinline
-
bw
private int bw
-
-
Method Detail
-
write
public void write(int b) throws java.io.IOException
- Overrides:
write
in classjava.io.FilterOutputStream
- Throws:
java.io.IOException
- See Also:
FilterOutputStream
-
checkedWrite
private void checkedWrite(byte[] buf) throws java.io.IOException
- Throws:
java.io.IOException
-
checkedWrite
private void checkedWrite(byte[] buf, boolean nosplit) throws java.io.IOException
- Throws:
java.io.IOException
-
checkedWrite
private void checkedWrite(byte[] buf, int len) throws java.io.IOException
- Throws:
java.io.IOException
-
checkedWrite
private void checkedWrite(byte[] buf, int len, boolean nosplit) throws java.io.IOException
- Throws:
java.io.IOException
-
convertWord
private byte[] convertWord(long word)
This converts a 32 bit value (4 bytes) into 5 bytes using base 85. each byte in the result starts with zero at the '!' character so the resulting base85 number fits into printable ascii chars- Parameters:
word
- the 32 bit unsigned (hence the long datatype) word- Returns:
- 5 bytes (or a single byte of the 'z' character for word values of 0)
-
finalizeStream
public void finalizeStream() throws java.io.IOException
Description copied from interface:Finalizable
This method can be called instead of close() on a subclass of FilteredOutputStream when a final marker has to be written to the target stream, but close() cannot be called.- Specified by:
finalizeStream
in interfaceFinalizable
- Throws:
java.io.IOException
- In case of an IO problem- See Also:
Finalizable
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.FilterOutputStream
- Throws:
java.io.IOException
- See Also:
FilterOutputStream
-
-