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:
Closeable
,Flushable
,AutoCloseable
,ASCII85Constants
,Finalizable
public class ASCII85OutputStream
extends FilterOutputStream
implements ASCII85Constants, Finalizable
This class applies a ASCII85 encoding to the stream.
- Version:
- $Id: ASCII85OutputStream.java 1804124 2017-08-04 14:13:54Z ssteiner $
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate long
private int
private static final boolean
private int
private int
Fields inherited from class java.io.FilterOutputStream
out
Fields inherited from interface org.apache.xmlgraphics.util.io.ASCII85Constants
END, EOD, EOL, POW85, START, ZERO, ZERO_ARRAY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate 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
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) Methods inherited from class java.io.FilterOutputStream
flush, write, write
Methods inherited from class java.io.OutputStream
nullOutputStream
-
Field Details
-
DEBUG
private static final boolean DEBUG- See Also:
-
pos
private int pos -
buffer
private long buffer -
posinline
private int posinline -
bw
private int bw
-
-
Constructor Details
-
ASCII85OutputStream
- See Also:
-
-
Method Details
-
write
- Overrides:
write
in classFilterOutputStream
- Throws:
IOException
- See Also:
-
checkedWrite
- Throws:
IOException
-
checkedWrite
- Throws:
IOException
-
checkedWrite
- Throws:
IOException
-
checkedWrite
- Throws:
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
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:
IOException
- In case of an IO problem- See Also:
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classFilterOutputStream
- Throws:
IOException
- See Also:
-