|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.InputStream
net.rim.device.api.io.Base64InputStream
public class Base64InputStream
Input stream for reading Base64 encoded data.
This class implements a stream which reads in and decodes Base64 encoded data. For a description of the Base64 encoding scheme, see RFC 2045. As per RFC 2045, all input characters not in the Base64 character table are ignored.
Sample code
Constructor Summary | ||
---|---|---|
Base64InputStream(InputStream inputStream)
Constructs a new Base64InputStream instance with underlying input stream. |
||
Base64InputStream(InputStream inputStream,
boolean treatErrorAsEOF)
Constructs a new Base64InputStream instance with underlying input stream. |
Method Summary | ||
---|---|---|
int |
available()
Retrieves number of available bytes. |
|
void |
close()
Closes this input stream. |
|
static byte[] |
decode(byte[] input,
int inputOffset,
int inputLength)
Decode the Base64 encoded input and return the result. |
|
static byte[] |
decode(String input)
Decode the Base64 encoded input and return the result. |
|
static byte[] |
decode(String input,
int inputOffset,
int inputLength)
Decode the Base64 encoded input and return the result. |
|
int |
read()
Reads one byte from this stream. |
|
int |
read(byte[] buffer)
Reads some bytes from this stream. |
|
int |
read(byte[] buffer,
int bufferOffset,
int bufferLength)
Read specified number of bytes from this stream. |
Methods inherited from class java.io.InputStream |
---|
mark, markSupported, reset, skip |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Base64InputStream(InputStream inputStream)
inputStream
- Underlying input stream.public Base64InputStream(InputStream inputStream, boolean treatErrorAsEOF)
inputStream
- Underlying input stream.treatErrorAsEOF
- A boolean to specify whether or not to treat a decoding error as the end of stream
or to just immediately throw an IOException.Method Detail |
---|
public int read() throws IOException
Invoke this method to read one byte from this stream.
read
in class InputStream
IOException
- If this stream is closed, the underlying stream has a
problem, or the input data is corrupted.public int read(byte[] buffer) throws IOException
Invoke this method to attempt to fill a provided output parameter byte array with data from this stream.
read
in class InputStream
buffer
- Buffer to contain read and decoded data.
IOException
- If this stream is closed, the underlying stream has a
problem, or the input data is corrupted.InputStream.read(byte[], int, int)
public int read(byte[] buffer, int bufferOffset, int bufferLength) throws IOException
read
in class InputStream
buffer
- Buffer to contain data; must be large enough to contain
desired number of bytes.bufferOffset
- First element in output parameter buffer at which to
begin writing decoded data; if not 0, then output parameter buffer must
be at least bufferOffset + bufferLength
elements long.bufferLength
- Number of bytes to read from this stream.
IOException
- If this stream is closed, the underlying stream has a
problem, or the input data is corrupted.InputStream.read()
public int available() throws IOException
Invoke this method to find out the number of bytes you can freely read (or skip over) from this stream (that is, without being blocked by another invocation of one of this stream's methods, on this or another thread).
available
in class InputStream
IOException
- If this stream is closed.public void close() throws IOException
Invoke this method to close this stream and release any system resources it uses.
close
in class InputStream
IOException
- If the underlying stream has a problem.public static byte[] decode(String input) throws IOException
input
- The Base64 encoded inputinputOffset
- The offset into the arrayinputLength
- The length of the input
IOException
- Thrown if a decoding error occurred.public static byte[] decode(String input, int inputOffset, int inputLength) throws IOException
input
- The Base64 encoded inputinputOffset
- The offset into the arrayinputLength
- The length of the input
IOException
- Thrown if a decoding error occurred.public static byte[] decode(byte[] input, int inputOffset, int inputLength) throws IOException
input
- The Base64 encoded inputinputOffset
- The offset into the arrayinputLength
- The length of the input
IOException
- Thrown if a decoding error occurred.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal