com.sun.mail.util
类 BASE64EncoderStream

java.lang.Object
  继承者 java.io.OutputStream
      继承者 java.io.FilterOutputStream
          继承者 com.sun.mail.util.BASE64EncoderStream
所有已实现的接口:
Closeable, Flushable
直接已知子类:
BEncoderStream

public class BASE64EncoderStream
extends FilterOutputStream

This class implements a BASE64 encoder. It is implemented as a FilterOutputStream, so one can just wrap this class around any output stream and write bytes into this filter. The encoding is done as the bytes are written out.

作者:
John Mani, Bill Shannon

字段摘要
 
从类 java.io.FilterOutputStream 继承的字段
out
 
构造方法摘要
BASE64EncoderStream(OutputStream out)
          Create a BASE64 encoder that encodes the specified input stream.
BASE64EncoderStream(OutputStream out, int bytesPerLine)
          Create a BASE64 encoder that encodes the specified output stream.
 
方法摘要
 void close()
          Forces any buffered output bytes to be encoded out to the stream and closes this output stream
static byte[] encode(byte[] inbuf)
          Base64 encode a byte array.
 void flush()
          Flushes this output stream and forces any buffered output bytes to be encoded out to the stream.
 void write(byte[] b)
          Encodes b.length bytes to this output stream.
 void write(byte[] b, int off, int len)
          Encodes len bytes from the specified byte array starting at offset off to this output stream.
 void write(int c)
          Encodes the specified byte to this output stream.
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

BASE64EncoderStream

public BASE64EncoderStream(OutputStream out,
                           int bytesPerLine)
Create a BASE64 encoder that encodes the specified output stream.

参数:
out - the output stream
bytesPerLine - number of bytes per line. The encoder inserts a CRLF sequence after the specified number of bytes, unless bytesPerLine is Integer.MAX_VALUE, in which case no CRLF is inserted. bytesPerLine is rounded down to a multiple of 4.

BASE64EncoderStream

public BASE64EncoderStream(OutputStream out)
Create a BASE64 encoder that encodes the specified input stream. Inserts the CRLF sequence after outputting 76 bytes.

参数:
out - the output stream
方法详细信息

write

public void write(byte[] b,
                  int off,
                  int len)
           throws IOException
Encodes len bytes from the specified byte array starting at offset off to this output stream.

覆盖:
FilterOutputStream 中的 write
参数:
b - the data.
off - the start offset in the data.
len - the number of bytes to write.
抛出:
IOException - if an I/O error occurs.

write

public void write(byte[] b)
           throws IOException
Encodes b.length bytes to this output stream.

覆盖:
FilterOutputStream 中的 write
参数:
b - the data to be written.
抛出:
IOException - if an I/O error occurs.

write

public void write(int c)
           throws IOException
Encodes the specified byte to this output stream.

覆盖:
FilterOutputStream 中的 write
参数:
c - the byte.
抛出:
IOException - if an I/O error occurs.

flush

public void flush()
           throws IOException
Flushes this output stream and forces any buffered output bytes to be encoded out to the stream.

指定者:
接口 Flushable 中的 flush
覆盖:
FilterOutputStream 中的 flush
抛出:
IOException - if an I/O error occurs.

close

public void close()
           throws IOException
Forces any buffered output bytes to be encoded out to the stream and closes this output stream

指定者:
接口 Closeable 中的 close
覆盖:
FilterOutputStream 中的 close
抛出:
IOException

encode

public static byte[] encode(byte[] inbuf)
Base64 encode a byte array. No line breaks are inserted. This method is suitable for short strings, such as those in the IMAP AUTHENTICATE protocol, but not to encode the entire content of a MIME part.



Copyright © 2013. All Rights Reserved.