com.sun.jini.jeri.internal.runtime
Class BASE64Encoder

java.lang.Object
  extended by com.sun.jini.jeri.internal.runtime.CharacterEncoder
      extended by com.sun.jini.jeri.internal.runtime.BASE64Encoder

public class BASE64Encoder
extends CharacterEncoder

This class implements a BASE64 Character encoder as specified in RFC1521. This RFC is part of the MIME specification as published by the Internet Engineering Task Force (IETF). Unlike some other encoding schemes there is nothing in this encoding that indicates where a buffer starts or ends. This means that the encoded text will simply start with the first line of encoded text and end with the last line of encoded text.

Author:
Sun Microsystems, Inc.
See Also:
CharacterEncoder

Field Summary
private static char[] pem_array
          This array maps the characters to their 6 bit values
 
Fields inherited from class com.sun.jini.jeri.internal.runtime.CharacterEncoder
pStream
 
Constructor Summary
BASE64Encoder()
           
 
Method Summary
protected  int bytesPerAtom()
          this class encodes three bytes per atom.
protected  int bytesPerLine()
          this class encodes 57 bytes per line.
protected  void encodeAtom(OutputStream outStream, byte[] data, int offset, int len)
          encodeAtom - Take three bytes of input and encode it as 4 printable characters.
 
Methods inherited from class com.sun.jini.jeri.internal.runtime.CharacterEncoder
encode, encode, encode, encodeBuffer, encodeBuffer, encodeBuffer, encodeBufferPrefix, encodeBufferSuffix, encodeLinePrefix, encodeLineSuffix, readFully
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pem_array

private static final char[] pem_array
This array maps the characters to their 6 bit values

Constructor Detail

BASE64Encoder

public BASE64Encoder()
Method Detail

bytesPerAtom

protected int bytesPerAtom()
this class encodes three bytes per atom.

Specified by:
bytesPerAtom in class CharacterEncoder

bytesPerLine

protected int bytesPerLine()
this class encodes 57 bytes per line. This results in a maximum of 57/3 * 4 or 76 characters per output line. Not counting the line termination.

Specified by:
bytesPerLine in class CharacterEncoder

encodeAtom

protected void encodeAtom(OutputStream outStream,
                          byte[] data,
                          int offset,
                          int len)
                   throws IOException
encodeAtom - Take three bytes of input and encode it as 4 printable characters. Note that if the length in len is less than three is encodes either one or two '=' signs to indicate padding characters.

Specified by:
encodeAtom in class CharacterEncoder
Throws:
IOException


Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.