Agent System POND 1.2 (28.2.2002)

FIM.Util.Coder.Base64
Class Base64OutputStream

java.lang.Object
  |
  +--java.io.OutputStream
        |
        +--java.io.FilterOutputStream
              |
              +--FIM.Util.Coder.Base64.Base64OutputStream

public class Base64OutputStream
extends FilterOutputStream

An output stream which encodes a file into base64 format.

Version:
1.1, 12 Jan 1997
Author:
Glenn Vanderburg, Michael Sonntag (Corrections)

Field Summary
(package private) static char[] b
          Base64 encoding bytes
(package private)  int chunksdone
          Number of chunks (3 bytes unencoded to 4 bytes encoded) done
(package private)  boolean finished
          if the encoding is finished
(package private) static byte PAD
          Padding byte
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
Base64OutputStream(OutputStream out)
          Creates a new Base64OutputStream.
Base64OutputStream(OutputStream out, boolean textfile)
          Creates a new Base64OutputStream, for a text file.
 
Method Summary
 void close()
          Closes the stream.
protected  void empty_buffer()
          Encode all buffered bytes and write the encoded bytes to the output stream.
static void main(String[] args)
          Test for Base64OutputStream.
 void write(byte[] b, int off, int len)
          Writes a subarray of bytes.
 void write(int b)
          Writes a byte.
 
Methods inherited from class java.io.FilterOutputStream
flush, write
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

chunksdone

int chunksdone
Number of chunks (3 bytes unencoded to 4 bytes encoded) done

finished

boolean finished
if the encoding is finished

b

static char[] b
Base64 encoding bytes

PAD

static byte PAD
Padding byte
Constructor Detail

Base64OutputStream

public Base64OutputStream(OutputStream out)
Creates a new Base64OutputStream.
Parameters:
out - the output stream

Base64OutputStream

public Base64OutputStream(OutputStream out,
                          boolean textfile)
Creates a new Base64OutputStream, for a text file. If the parameter textfile is true, a \n will be written as \r\n.
Parameters:
out - the output stream
textfile - true if the file is a text file.
Method Detail

write

public void write(int b)
           throws IOException
Writes a byte. This method will block until the byte is actually written.
Overrides:
write in class FilterOutputStream
Parameters:
b - the byte to write
Throws:
IOException - if an I/O error has occurred.

write

public void write(byte[] b,
                  int off,
                  int len)
           throws IOException
Writes a subarray of bytes.
Overrides:
write in class FilterOutputStream
Parameters:
b - the data to be written
off - the start offset in the data
len - the number of bytes that are written
Throws:
IOException - if an I/O error has occurred.

close

public void close()
           throws IOException
Closes the stream.
Overrides:
close in class FilterOutputStream
Throws:
IOException - if an I/O error has occurred.

empty_buffer

protected void empty_buffer()
                     throws IOException
Encode all buffered bytes and write the encoded bytes to the output stream.
Throws:
IOException - if an I/O error has occurred.

main

public static void main(String[] args)
Test for Base64OutputStream.

Agent System POND 1.2 (28.2.2002)

Submit a bug

Copyright 2001,2002 Michael Sonntag & Institute for Information Processing and Microprocessor Technology (FIM), Johannes-Kepler-University Linz, Altenbergerstr. 69, A-4040 Linz, Austria.