com.bytecream.codec
Class Base64EncoderIO

java.lang.Object
  extended bycom.bytecream.codec.Base64EncoderIO

public final class Base64EncoderIO
extends java.lang.Object

Provides a set of static methods to encode a stream with the Base64 algorithm.

The method encodeWithLineSeparator(...) uses the system line separator provided by System.getProperty("line.separator"). This line separator must be CRLF or a string of length 1.

For the best performance, use this library in server mode and disable assertions.
java -server ...


Method Summary
static void encodeWithCRLF(java.io.InputStream _input, java.io.OutputStream _output)
          Encodes the data read from an input stream and write it on an output stream, inserting a CRLF every 76 characters.
static void encodeWithLineSeparator(java.io.InputStream _input, java.io.OutputStream _output)
          Encodes the data read from an input stream and write it on an output stream, inserting a line separator every 76 characters.
static void encodeWithLineSeparator(java.io.InputStream _input, java.io.OutputStream _output, boolean _end)
          Encodes the data read from an input stream and write it on an output stream, inserting a line separator every 76 characters.
static void encodeWithoutSeparator(java.io.InputStream _input, java.io.OutputStream _output)
          Encodes the data read from an input stream and write it on an output stream.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

encodeWithCRLF

public static final void encodeWithCRLF(java.io.InputStream _input,
                                        java.io.OutputStream _output)
                                 throws java.io.IOException
Encodes the data read from an input stream and write it on an output stream, inserting a CRLF every 76 characters. There is always a CRLF written at the end except if there is no input. You should use a buffered input stream.

Parameters:
_input - the input stream to read.
_output - the output stream to write on.
Throws:
java.io.IOException - if an I/O error occurs.

encodeWithLineSeparator

public static final void encodeWithLineSeparator(java.io.InputStream _input,
                                                 java.io.OutputStream _output)
                                          throws java.io.IOException
Encodes the data read from an input stream and write it on an output stream, inserting a line separator every 76 characters. There is always a line separator written at the end except if there is no input. You should use a buffered input stream.

Parameters:
_input - the input stream to read.
_output - the output stream to write on.
Throws:
java.io.IOException - if an I/O error occurs.

encodeWithLineSeparator

public static final void encodeWithLineSeparator(java.io.InputStream _input,
                                                 java.io.OutputStream _output,
                                                 boolean _end)
                                          throws java.io.IOException
Encodes the data read from an input stream and write it on an output stream, inserting a line separator every 76 characters. You should use a buffered input stream.

Parameters:
_input - the input stream to read.
_output - the output stream to write on.
_end - if true add a line separator to the final line, if false, add a line separator only if it has exactly 76 characters.
Throws:
java.io.IOException - if an I/O error occurs.

encodeWithoutSeparator

public static final void encodeWithoutSeparator(java.io.InputStream _input,
                                                java.io.OutputStream _output)
                                         throws java.io.IOException
Encodes the data read from an input stream and write it on an output stream. No separator is inserted. You should use a buffered input stream.

Parameters:
_input - the input stream to read.
_output - the output stream to write on.
Throws:
java.io.IOException - if an I/O error occurs.



Copyright © 2004 ByteCream.
All Rights Reserved.