|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.io.InputStream | +--java.io.FilterInputStream | +--org.shlublu.javax.data.Base64InputStream
RFC 2045 compliant Base 64 stream decoder.
This stream filters a given InputStream
The data is decoded following the calls of read()
or read(byte[],int,int)
. Due to the fact that code can
contain linebreaks, LF and CR are silentely ignored.
Code can also terminate by 1 or 2 padding characters.
The consequence is that the available()
method may return
a larger number than the actual number of available bytes, since this
method returns the maximal expected value.
0 is the only certified value for available()
.
To test the return values of read()
, read(byte[])
and
read(byte[],int,int)
is required to detect the actual end of code.
Base64
Fields inherited from class java.io.FilterInputStream |
in |
Constructor Summary | |
Base64InputStream(java.io.InputStream istream)
Create this filter using the given InputStream |
Method Summary | |
int |
available()
Returns the number of bytes that can be decoded from this input stream without blocking. |
void |
close()
Closes this input stream and releases any system resources associated with the stream. |
void |
mark(int readlimit)
Do nothing, since marks aren't supported |
boolean |
markSupported()
Always return false, since marks aren't supported |
int |
read()
Decode the next byte of data from this input stream. |
int |
read(byte[] abyStorage,
int iStartOffset,
int iLength)
Decode up to iLength bytes of data into the given array. |
void |
reset()
Always throw an exception, since marks aren't supported |
long |
skip(long iNbToSkip)
Not applicable to this stream, always return 0 |
Methods inherited from class java.io.FilterInputStream |
read |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Base64InputStream(java.io.InputStream istream)
InputStream
istream
- The stream to filterMethod Detail |
public int available() throws java.io.IOException
nb_quanta * 3
available
in class java.io.FilterInputStream
public void close() throws java.io.IOException
close
in class java.io.FilterInputStream
public int read() throws java.io.IOException
available()
method may return an excessive value, to check the return
value of read()
is required.read
in class java.io.FilterInputStream
available()
public int read(byte[] abyStorage, int iStartOffset, int iLength) throws java.io.IOException
available()
.
For this reason, to check the read(byte[],int,int)
return value is required, and so for super.read(byte[])
.read
in class java.io.FilterInputStream
abyStorage
- The array used to store decoded dataiStartOffset
- The index to begin to store atiLength
- The maximal length to be decodedavailable()
,
FilterInputStream.read(byte[])
public long skip(long iNbToSkip) throws java.io.IOException
skip
in class java.io.FilterInputStream
iNbToSkip
- The number of bytes to skippublic void mark(int readlimit)
mark
in class java.io.FilterInputStream
public void reset() throws java.io.IOException
reset
in class java.io.FilterInputStream
public boolean markSupported()
markSupported
in class java.io.FilterInputStream
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |