Class Base64Decoder

  • All Implemented Interfaces:
    Decoder

    public final class Base64Decoder
    extends java.lang.Object
    implements Decoder
    Decoder implementation for standard base64 encoding.
    Version:
    $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/main/java/com/twelvemonkeys/io/enc/Base64Decoder.java#2 $
    See Also:
    RFC 1421, RFC 2045, Base64Encoder
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private byte[] decodeBuffer  
      (package private) static byte[] PEM_ARRAY
      This array maps the characters to their 6 bit values
      (package private) static byte[] PEM_CONVERT_ARRAY  
    • Constructor Summary

      Constructors 
      Constructor Description
      Base64Decoder()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int decode​(java.io.InputStream stream, java.nio.ByteBuffer buffer)
      Decodes up to buffer.length bytes from the given input stream, into the given buffer.
      protected boolean decodeAtom​(java.io.InputStream pInput, java.nio.ByteBuffer pOutput, int pLength)  
      protected static int readFully​(java.io.InputStream pStream, byte[] pBytes, int pOffset, int pLength)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • PEM_ARRAY

        static final byte[] PEM_ARRAY
        This array maps the characters to their 6 bit values
      • PEM_CONVERT_ARRAY

        static final byte[] PEM_CONVERT_ARRAY
      • decodeBuffer

        private byte[] decodeBuffer
    • Constructor Detail

      • Base64Decoder

        public Base64Decoder()
    • Method Detail

      • readFully

        protected static int readFully​(java.io.InputStream pStream,
                                       byte[] pBytes,
                                       int pOffset,
                                       int pLength)
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • decodeAtom

        protected boolean decodeAtom​(java.io.InputStream pInput,
                                     java.nio.ByteBuffer pOutput,
                                     int pLength)
                              throws java.io.IOException
        Throws:
        java.io.IOException
      • decode

        public int decode​(java.io.InputStream stream,
                          java.nio.ByteBuffer buffer)
                   throws java.io.IOException
        Description copied from interface: Decoder
        Decodes up to buffer.length bytes from the given input stream, into the given buffer.
        Specified by:
        decode in interface Decoder
        Parameters:
        stream - the input stream to decode data from
        buffer - buffer to store the read data
        Returns:
        the total number of bytes read into the buffer, or 0 if there is no more data because the end of the stream has been reached.
        Throws:
        DecodeException - if encoded data is corrupt.
        java.io.IOException - if an I/O error occurs.
        java.io.EOFException - if a premature end-of-file is encountered.