Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## edu.emory.mathcs.util.io
Class Base64Encoder

    java.lang.Object
      java.io.OutputStream
          edu.emory.mathcs.util.io.Base64Encoder

public class Base64Encoder
extends java.io.OutputStream

Output stream that base64-encodes supplied data on-the-fly, that is, it transforms a byte stream into a base64-encoded character stream. It also offers static methods for offline encoding, that is, converting byte arrays to base64-encoded strings.

Version:
  1.0
Author:
  Dawid Kurzyniec

Constructor Summary
`Base64Encoder(java.io.Writer out)`

Method Summary
`void` | `close()`
`static java.lang.String` | `encode(byte[] buf)` Converts the specified byte array into its base64 encoding.
`static java.lang.String` | `encode(byte[] buf, int off, int len)` Converts the specified byte array region into its base64 encoding.
`void` | `flush()` Flushes the underlying stream.
`void` | `write(byte[] buf, int off, int len)`
`void` | `write(int v)`

Methods inherited from class java.io.OutputStream
`write`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Base64Encoder

    public Base64Encoder(java.io.Writer out)

Method Detail

### write

    public void write(byte[] buf,
                      int off,
                      int len)
               throws java.io.IOException

  Throws:
    `java.io.IOException`

### write

    public void write(int v)
               throws java.io.IOException

  Throws:
    `java.io.IOException`

### flush

    public void flush()
               throws java.io.IOException

  Flushes the underlying stream. Because base64 operates on triples of bytes, this method does NOT guarantee to propagate all bytes written thus far. Up to two bytes may remain in the internal buffer, awaiting the next byte to complete the triple.

  Throws:
    `java.io.IOException` - if I/O error occurs

### close

    public void close()
               throws java.io.IOException

  Throws:
    `java.io.IOException`

### encode

    public static java.lang.String encode(byte[] buf)

  Converts the specified byte array into its base64 encoding.

  Parameters:
    `buf` - the buffer to encode
  Returns:
    the base64-encoded data

### encode

    public static java.lang.String encode(byte[] buf,
                                          int off,
                                          int len)

  Converts the specified byte array region into its base64 encoding.

  Parameters:
    `buf` - the buffer containing the data to encode
    `off` - the start offset in the buffer
    `len` - the number of bytes to encode
  Returns:
    the base64-encoded data

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD