|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.ws.commons.util.Base64
public class Base64
Performs Base64 encoding and/or decoding. This is an on-the-fly decoder: Unlike, for example, the commons-codec classes, it doesn't depend on byte arrays. In other words, it has an extremely low memory profile. This is well suited even for very large byte streams.
Nested Class Summary | |
---|---|
static class |
Base64.Decoder
An encoder is an object, which is able to decode char arrays in blocks of four bytes. |
static class |
Base64.DecodingException
An exception of this type is thrown, if the decoded character stream contains invalid input. |
static class |
Base64.Encoder
An encoder is an object, which is able to encode byte array in blocks of three bytes. |
static class |
Base64.EncoderOutputStream
An OutputStream , which is writing to the given
Base64.Encoder . |
static class |
Base64.SAXEncoder
An Base64.Encoder , which is writing to a SAX content handler. |
static class |
Base64.SAXIOException
An exception of this type is thrown by the Base64.SAXEncoder ,
if writing to the target handler causes a SAX exception. |
Field Summary | |
---|---|
static java.lang.String |
LINE_SEPARATOR
Default line separator: \n |
static int |
LINE_SIZE
Default size for line wrapping. |
Constructor Summary | |
---|---|
Base64()
|
Method Summary | |
---|---|
static byte[] |
decode(char[] pBuffer)
Converts the given base64 encoded character buffer into a byte array. |
static byte[] |
decode(char[] pBuffer,
int pOffset,
int pLength)
Converts the given base64 encoded character buffer into a byte array. |
static byte[] |
decode(java.lang.String pBuffer)
Converts the given base64 encoded String into a byte array. |
static java.lang.String |
encode(byte[] pBuffer)
Converts the given byte array into a base64 encoded character array with the line size LINE_SIZE and the separator
LINE_SEPARATOR . |
static java.lang.String |
encode(byte[] pBuffer,
int pOffset,
int pLength)
Converts the given byte array into a base64 encoded character array. |
static java.lang.String |
encode(byte[] pBuffer,
int pOffset,
int pLength,
int pLineSize,
java.lang.String pSeparator)
Converts the given byte array into a base64 encoded character array. |
java.io.Writer |
newDecoder(java.io.OutputStream pStream)
Returns a Writer , that decodes its Base64 encoded
input and writes it to the given OutputStream . |
static java.io.OutputStream |
newEncoder(java.io.Writer pWriter)
Returns an OutputStream , that encodes its input in Base64
and writes it to the given Writer . |
static java.io.OutputStream |
newEncoder(java.io.Writer pWriter,
int pLineSize,
java.lang.String pSeparator)
Returns an OutputStream , that encodes its input in Base64
and writes it to the given Writer . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String LINE_SEPARATOR
public static final int LINE_SIZE
Constructor Detail |
---|
public Base64()
Method Detail |
---|
public static java.io.OutputStream newEncoder(java.io.Writer pWriter)
OutputStream
, that encodes its input in Base64
and writes it to the given Writer
. If the Base64 stream
ends, then the output streams OutputStream.close()
method
must be invoked. Note, that this will not close the
target Writer
!
pWriter
- Target writer.
pWriter
.public static java.io.OutputStream newEncoder(java.io.Writer pWriter, int pLineSize, java.lang.String pSeparator)
OutputStream
, that encodes its input in Base64
and writes it to the given Writer
. If the Base64 stream
ends, then the output streams OutputStream.close()
method
must be invoked. Note, that this will not close the
target Writer
!
pWriter
- Target writer.pLineSize
- Size of one line in characters, must be a multiple
of four. Zero indicates, that no line wrapping should occur.pSeparator
- Line separator or null, in which case the default value
LINE_SEPARATOR
is used.
pWriter
.public static java.lang.String encode(byte[] pBuffer, int pOffset, int pLength)
pBuffer
- The buffer being encoded.pOffset
- Offset in buffer, where to begin encoding.pLength
- Number of bytes being encoded.
public static java.lang.String encode(byte[] pBuffer, int pOffset, int pLength, int pLineSize, java.lang.String pSeparator)
pBuffer
- The buffer being encoded.pOffset
- Offset in buffer, where to begin encoding.pLength
- Number of bytes being encoded.pLineSize
- Size of one line in characters, must be a multiple
of four. Zero indicates, that no line wrapping should occur.pSeparator
- Line separator or null, in which case the default value
LINE_SEPARATOR
is used.
public static java.lang.String encode(byte[] pBuffer)
LINE_SIZE
and the separator
LINE_SEPARATOR
.
pBuffer
- The buffer being encoded.
public java.io.Writer newDecoder(java.io.OutputStream pStream)
Writer
, that decodes its Base64 encoded
input and writes it to the given OutputStream
.
Note, that the writers Writer.close()
method will
not close the output stream pStream
!
pStream
- Target output stream.
pWriter
.public static byte[] decode(char[] pBuffer, int pOffset, int pLength) throws Base64.DecodingException
pBuffer
- The character buffer being decoded.pOffset
- Offset of first character being decoded.pLength
- Number of characters being decoded.
Base64.DecodingException
- The input character stream contained invalid data.public static byte[] decode(char[] pBuffer) throws Base64.DecodingException
pBuffer
- The character buffer being decoded.
Base64.DecodingException
- The input character stream contained invalid data.public static byte[] decode(java.lang.String pBuffer) throws Base64.DecodingException
pBuffer
- The string being decoded.
Base64.DecodingException
- The input character stream contained invalid data.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |