|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectjava.io.OutputStream
java.io.FilterOutputStream
com.oreilly.servlet.Base64Encoder
public class Base64Encoder
A class to encode Base64 streams and strings. See RFC 1521 section 5.2 for details of the Base64 algorithm.
This class can be used for encoding strings:
or for encoding streams:String unencoded = "webmaster:try2gueSS"; String encoded = Base64Encoder.encode(unencoded);
OutputStream out = new Base64Encoder(System.out);
| 字段摘要 |
|---|
| 从类 java.io.FilterOutputStream 继承的字段 |
|---|
out |
| 构造方法摘要 | |
|---|---|
Base64Encoder(OutputStream out)
Constructs a new Base64 encoder that writes output to the given OutputStream. |
|
| 方法摘要 | |
|---|---|
void |
close()
Closes the stream, this MUST be called to ensure proper padding is written to the end of the output stream. |
static String |
encode(byte[] bytes)
Returns the encoded form of the given unencoded string. |
static String |
encode(String unencoded)
Returns the encoded form of the given unencoded string. |
static void |
main(String[] args)
|
void |
write(byte[] buf,
int off,
int len)
Writes the given byte array to the output stream in an encoded form. |
void |
write(int b)
Writes the given byte to the output stream in an encoded form. |
| 从类 java.io.FilterOutputStream 继承的方法 |
|---|
flush, write |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 构造方法详细信息 |
|---|
public Base64Encoder(OutputStream out)
out - the output stream| 方法详细信息 |
|---|
public void write(int b)
throws IOException
FilterOutputStream 中的 writeIOException - if an I/O error occurs
public void write(byte[] buf,
int off,
int len)
throws IOException
FilterOutputStream 中的 writebuf - the data to be writtenoff - the start offset of the datalen - the length of the data
IOException - if an I/O error occurs
public void close()
throws IOException
Closeable 中的 closeFilterOutputStream 中的 closeIOException - if an I/O error occurspublic static String encode(String unencoded)
unencoded - the string to encode
public static String encode(byte[] bytes)
bytes - the bytes to encode
public static void main(String[] args)
throws Exception
Exception
|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||