Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

iiuf.util
Class Base64Encoder  view Base64Encoder download Base64Encoder.java

java.lang.Object
  extended byiiuf.util.Base64Encoder

public class Base64Encoder
extends java.lang.Object

BASE64 encoder implementation. This object takes as parameter an input stream and an output stream. It encodes the input stream, using the BASE64 encoding rules, as defined in MIME specification and emit the resulting data to the output stream.


Field Summary
private static int BUFFER_SIZE
           
private static byte[] encoding
           
(package private)  java.io.InputStream in
           
(package private)  java.io.OutputStream out
           
(package private)  boolean stringp
           
 
Constructor Summary
Base64Encoder(java.math.BigInteger bint)
          Create a new Base64 encoder, to encode the given BigInteger.
Base64Encoder(byte[] bytes)
          Create a new Base64 encoder, to encode the given byte array.
Base64Encoder(java.io.InputStream in, java.io.OutputStream out)
          Create a new Base64 encoder, encoding input to output.
Base64Encoder(java.lang.String input)
          Create a new Base64 encoder, to encode the given string.
 
Method Summary
private  int get1(byte[] buf, int off)
           
private  int get2(byte[] buf, int off)
           
private  int get3(byte[] buf, int off)
           
private static int get4(byte[] buf, int off)
           
static void main(java.lang.String[] args)
          Testing the encoder.
 void process()
          Process the data: encode the input stream to the output stream.
 java.lang.String processString()
          Encode the content of this encoder, as a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BUFFER_SIZE

private static final int BUFFER_SIZE
See Also:
Constant Field Values

encoding

private static byte[] encoding

in

java.io.InputStream in

out

java.io.OutputStream out

stringp

boolean stringp
Constructor Detail

Base64Encoder

public Base64Encoder(java.lang.String input)
Create a new Base64 encoder, to encode the given string.


Base64Encoder

public Base64Encoder(java.io.InputStream in,
                     java.io.OutputStream out)
Create a new Base64 encoder, encoding input to output.


Base64Encoder

public Base64Encoder(byte[] bytes)
Create a new Base64 encoder, to encode the given byte array.


Base64Encoder

public Base64Encoder(java.math.BigInteger bint)
Create a new Base64 encoder, to encode the given BigInteger.

Method Detail

get1

private final int get1(byte[] buf,
                       int off)

get2

private final int get2(byte[] buf,
                       int off)

get3

private final int get3(byte[] buf,
                       int off)

get4

private static final int get4(byte[] buf,
                              int off)

process

public void process()
             throws java.io.IOException
Process the data: encode the input stream to the output stream. This method runs through the input stream, encoding it to the output stream.


processString

public java.lang.String processString()
Encode the content of this encoder, as a string. This methods encode the String content, that was provided at creation time, following the BASE64 rules, as specified in the rfc1521.


main

public static void main(java.lang.String[] args)
Testing the encoder. Run with one argument, prints the encoded version of it.