|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.io.InputStream java.io.FilterInputStream com.gridsystems.Base64Decoder
public class Base64Decoder
A class to decode Base64 streams and strings. See RFC 1521 section 5.2 for details of the Base64 algorithm.
This class can be used for decoding strings:
or for decoding streams:String encoded = "d2VibWFzdGVyOnRyeTJndWVTUw"; String decoded = Base64Decoder.decode(encoded);
InputStream in = new Base64Decoder(System.in);
Field Summary |
---|
Fields inherited from class java.io.FilterInputStream |
---|
in |
Constructor Summary | |
---|---|
Base64Decoder(java.io.InputStream in)
Constructs a new Base64 decoder that reads input from the given InputStream. |
Method Summary | |
---|---|
static byte[] |
binaryDecode(byte[] encoded)
Returns the decoded form of the given encoded byte array. |
static java.lang.String |
decode(java.lang.String encoded)
Returns the decoded form of the given encoded string. |
int |
read()
Returns the next decoded character from the stream, or -1 if end of stream was reached. |
int |
read(byte[] b,
int off,
int len)
Reads decoded data into an array of bytes and returns the actual number of bytes read, or -1 if end of stream was reached. |
Methods inherited from class java.io.FilterInputStream |
---|
available, close, mark, markSupported, read, reset, skip |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Base64Decoder(java.io.InputStream in)
in
- the input streamMethod Detail |
---|
public int read() throws java.io.IOException
read
in class java.io.FilterInputStream
java.io.IOException
- if an I/O error occurspublic int read(byte[] b, int off, int len) throws java.io.IOException
read
in class java.io.FilterInputStream
b
- the buffer into which the data is readoff
- the start offset of the datalen
- the maximum number of bytes to read
java.io.IOException
- if an I/O error occurspublic static java.lang.String decode(java.lang.String encoded)
encoded
- the string to decode
public static byte[] binaryDecode(byte[] encoded)
encoded
- the byte array to decode
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |