Module org.refcodes.forwardsecrecy
Package edu.vt.middleware.crypt.io
Class Base64FilterOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
edu.vt.middleware.crypt.io.AbstractEncodingFilterOutputStream
edu.vt.middleware.crypt.io.Base64FilterOutputStream
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
Encodes raw bytes into base-64 encoded character bytes in the wrapped output
stream.
- Version:
- $Revision: 2744 $
- Author:
- Middleware Services
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Wrap lines at 64 characters.static final int
Wrap lines at 76 characters.static final char
Line termination character.Fields inherited from class java.io.FilterOutputStream
out
-
Constructor Summary
ConstructorDescriptionCreates a base-64 filter output stream around the given output stream.Base64FilterOutputStream
(OutputStream out, int charsPerLine) /** Creates a base-64 filter output stream around the given output stream. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
protected void
Encodes the contents of the write buffer and writes the result to the wrapped output stream.protected void
writeEncoded
(byte[] data, int offset, int length) Encode the given raw bytes and write the result to the wrapped output stream.Methods inherited from class edu.vt.middleware.crypt.io.AbstractEncodingFilterOutputStream
write, write, write
Methods inherited from class java.io.FilterOutputStream
flush
Methods inherited from class java.io.OutputStream
nullOutputStream
-
Field Details
-
LINE_LENGTH_64
public static final int LINE_LENGTH_64Wrap lines at 64 characters.- See Also:
-
LINE_LENGTH_76
public static final int LINE_LENGTH_76Wrap lines at 76 characters.- See Also:
-
LINE_TERMINATOR
public static final char LINE_TERMINATORLine termination character.- See Also:
-
-
Constructor Details
-
Base64FilterOutputStream
Creates a base-64 filter output stream around the given output stream.- Parameters:
out
- Output stream to wrap.
-
Base64FilterOutputStream
/** Creates a base-64 filter output stream around the given output stream.- Parameters:
out
- Output stream to wrap.charsPerLine
- Number of characters per line of encoded output. Must be one ofLINE_LENGTH_64
,LINE_LENGTH_76
, or 0 to indicate no wrapping.
-
-
Method Details
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classFilterOutputStream
- Throws:
IOException
-
writeEncoded
Encode the given raw bytes and write the result to the wrapped output stream.- Specified by:
writeEncoded
in classAbstractEncodingFilterOutputStream
- Parameters:
data
- Raw bytes to be encoded and written.offset
- Starting index of data to be written in input byte array.length
- Number of bytes to be written from input byte array.- Throws:
IOException
- On write errors.
-
flushToStream
Encodes the contents of the write buffer and writes the result to the wrapped output stream.- Throws:
IOException
- On write errors.
-