public class Base64Codec extends Object implements IByteArrayCodec
| Constructor and Description |
|---|
Base64Codec() |
| Modifier and Type | Method and Description |
|---|---|
protected Base64InputStream |
createBase64InputStream(NonBlockingByteArrayInputStream aBAIS) |
protected Base64OutputStream |
createBase64OutputStream(OutputStream aOS) |
void |
decode(byte[] aEncodedBuffer,
int nOfs,
int nLen,
OutputStream aOS)
Decode (part of) a byte array.
|
void |
encode(byte[] aDecodedBuffer,
int nOfs,
int nLen,
OutputStream aOS)
Encode (part of) a byte array to an
OutputStream. |
byte[] |
getDecoded(byte[] aEncodedBuffer,
int nOfs,
int nLen)
Decode a byte array.
|
byte[] |
getEncoded(byte[] aDecodedBuffer,
int nOfs,
int nLen)
Encode a byte array.
|
int |
getMaximumDecodedLength(int nLen)
Get the maximum decoded length based on the provided encoded length.
|
int |
getMaximumEncodedLength(int nLen)
Get the maximum encoded length based on the provided decoded length.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdecode, getDecodedAsString, getDecodedAsString, getDecodedAsString, getDecodedAsStringgetDecoded, getDecoded, getDecodedLengthencode, getEncoded, getEncoded, getEncodedAsString, getEncodedAsString, getEncodedAsStringgetEncodedLengthpublic int getMaximumEncodedLength(int nLen)
IByteArrayEncodergetMaximumEncodedLength in interface IByteArrayEncodergetMaximumEncodedLength in interface IByteArrayStreamEncodernLen - The decoded length. Always ≥ 0.@Nonnull @OverrideOnDemand protected Base64OutputStream createBase64OutputStream(@Nonnull @WillNotClose OutputStream aOS)
public void encode(@Nullable byte[] aDecodedBuffer, @Nonnegative int nOfs, @Nonnegative int nLen, @Nonnull @WillNotClose OutputStream aOS)
IByteArrayStreamEncoderOutputStream.encode in interface IByteArrayStreamEncoderaDecodedBuffer - The byte array to be encoded. May be null.nOfs - Offset into the byte array to start from.nLen - Number of bytes starting from offset to consider.aOS - The output stream to write to. May not be null and is
NOT closed afterwards!@Nullable @ReturnsMutableCopy public byte[] getEncoded(@Nullable byte[] aDecodedBuffer, @Nonnegative int nOfs, @Nonnegative int nLen)
IByteArrayStreamEncodergetEncoded in interface IByteArrayEncodergetEncoded in interface IByteArrayStreamEncoderaDecodedBuffer - The byte array to be encoded. May be null.nOfs - Offset into the byte array to start from.nLen - Number of bytes starting from offset to consider.null if the parameter was
null.public int getMaximumDecodedLength(int nLen)
IByteArrayDecodergetMaximumDecodedLength in interface IByteArrayDecodernLen - The encoded length. Always ≥ 0.@Nonnull @OverrideOnDemand protected Base64InputStream createBase64InputStream(@Nonnull NonBlockingByteArrayInputStream aBAIS)
public void decode(@Nullable byte[] aEncodedBuffer, @Nonnegative int nOfs, @Nonnegative int nLen, @Nonnull @WillNotClose OutputStream aOS)
IByteArrayStreamDecoderdecode in interface IByteArrayStreamDecoderaEncodedBuffer - The byte array to be decoded. May be null.nOfs - Offset into the byte array to start from.nLen - Number of bytes starting from offset to consider.aOS - The output stream to write to. May not be null and is
NOT closed afterwards!@Nullable @ReturnsMutableCopy public byte[] getDecoded(@Nullable byte[] aEncodedBuffer, @Nonnegative int nOfs, @Nonnegative int nLen)
IByteArrayStreamDecodergetDecoded in interface IByteArrayDecodergetDecoded in interface IByteArrayStreamDecoderaEncodedBuffer - The byte array to be decoded. May be null.nOfs - Offset into the byte array to start from.nLen - Number of bytes starting from offset to consider.null if the parameter was
null.Copyright © 2014–2020 Philip Helger. All rights reserved.