Class Base64.Encoder

java.lang.Object
org.apache.ws.commons.util.Base64.Encoder
Direct Known Subclasses:
Base64.SAXEncoder
Enclosing class:
Base64

public abstract static class Base64.Encoder extends Object
An encoder is an object, which is able to encode byte array in blocks of three bytes. Any such block is converted into an array of four bytes.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final char[]
     
    private int
     
    private int
     
    private int
     
    private int
     
    private final String
     
    private final int
     
    private final int
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Encoder(char[] pBuffer, int pWrapSize, String pSep)
    Creates a new instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Writes any currently buffered data to the destination.
    private void
     
    void
    write(byte[] pBuffer, int pOffset, int pLen)
    Encodes the given byte array.
    protected abstract void
    writeBuffer(char[] pChars, int pOffset, int pLen)
    Called for writing the buffer contents to the target.

    Methods inherited from class java.lang.Object

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

    • num

      private int num
    • numBytes

      private int numBytes
    • charBuffer

      private final char[] charBuffer
    • charOffset

      private int charOffset
    • wrapSize

      private final int wrapSize
    • skipChars

      private final int skipChars
    • sep

      private final String sep
    • lineChars

      private int lineChars
  • Constructor Details

    • Encoder

      protected Encoder(char[] pBuffer, int pWrapSize, String pSep)
      Creates a new instance.
      Parameters:
      pBuffer - The encoders buffer. The encoder will write to the buffer as long as possible. If the buffer is full or the end of data is signaled, then the method writeBuffer(char[], int, int) will be invoked.
      pWrapSize - A nonzero value indicates, that a line wrap should be performed after the given number of characters. The value must be a multiple of 4. Zero indicates, that no line wrap should be performed.
      pSep - The eol sequence being used to terminate a line in case of line wraps. May be null, in which case the default value Base64.LINE_SEPARATOR is being used.
  • Method Details

    • writeBuffer

      protected abstract void writeBuffer(char[] pChars, int pOffset, int pLen) throws IOException
      Called for writing the buffer contents to the target.
      Parameters:
      pChars - The buffer being written.
      pOffset - Offset of first character being written.
      pLen - Number of characters being written.
      Throws:
      IOException - Writing to the destination failed.
    • wrap

      private void wrap()
    • write

      public void write(byte[] pBuffer, int pOffset, int pLen) throws IOException
      Encodes the given byte array.
      Parameters:
      pBuffer - Byte array being encoded.
      pOffset - Offset of first byte being encoded.
      pLen - Number of bytes being encoded.
      Throws:
      IOException - Invoking the writeBuffer(char[],int,int) method for writing the encoded data failed.
    • flush

      public void flush() throws IOException
      Writes any currently buffered data to the destination.
      Throws:
      IOException - Invoking the writeBuffer(char[],int,int) method for writing the encoded data failed.