Compoze Software, Inc.

com.compoze.util
Class Base64OutputStream

java.lang.Object
  extended byjava.io.OutputStream
      extended byjava.io.FilterOutputStream
          extended bycom.compoze.util.Base64OutputStream

public class Base64OutputStream
extends java.io.FilterOutputStream

This class provides an implementation of a Base 64 encoder in the form of an extension of FilterOutputStream. It is based on the implementation of BASE64EncoderStream from Sun's JDK utility classes.


Field Summary
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
Base64OutputStream(java.io.OutputStream os)
          Constructor.
Base64OutputStream(java.io.OutputStream os, int i)
          Constructor.
 
Method Summary
 void close()
          Flushes and closes the stream.
 void encode()
          Encodes the buffer.
static byte[] encode(byte[] abyte0)
          Encodes a buffer to a new byte array.
 void flush()
          Flushes the encoder and the underlying OutputStream.
 void write(byte[] abyte0)
          Writes a byte array.
 void write(byte[] abyte0, int i, int j)
          Writes a byte array.
 void write(int i)
          Writes a single byte.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Base64OutputStream

public Base64OutputStream(java.io.OutputStream os,
                          int i)
Constructor.

Parameters:
os - the underlying OutputStream
i - bytes per line

Base64OutputStream

public Base64OutputStream(java.io.OutputStream os)
Constructor. The standard of 76 bytes per line is used.

Parameters:
os - the underlying OutputStream
Method Detail

write

public void write(byte[] abyte0,
                  int i,
                  int j)
           throws java.io.IOException
Writes a byte array.

Parameters:
abyte0 - the byte array to write
i - the offset in the array
j - the length
Throws:
java.io.IOException - if an i/o error occurred

write

public void write(byte[] abyte0)
           throws java.io.IOException
Writes a byte array.

Parameters:
abyte0 - the byte array to write
Throws:
java.io.IOException - if an i/o error occurred

write

public void write(int i)
           throws java.io.IOException
Writes a single byte.

Throws:
java.io.IOException - if an i/o error occurred

flush

public void flush()
           throws java.io.IOException
Flushes the encoder and the underlying OutputStream.

Throws:
java.io.IOException - if an i/o error occurred

close

public void close()
           throws java.io.IOException
Flushes and closes the stream.

Throws:
java.io.IOException - if an i/o error occurred

encode

public void encode()
            throws java.io.IOException
Encodes the buffer.

Throws:
java.io.IOException

encode

public static byte[] encode(byte[] abyte0)
Encodes a buffer to a new byte array.

Parameters:
abyte0 - the buffer

Compoze Software, Inc.

Copyright ©1999-2003 Compoze Software, Inc. All rights reserved.