Package com._1c.g5.v8.dt.core.streams
Class HandlerBase64
- java.lang.Object
-
- com._1c.g5.v8.dt.core.streams.HandlerBase64
-
public class HandlerBase64 extends Object
Handler of sequences of bytes for encode/decode it to base64
Need to maintain compatibility with c++ code
-
-
Field Summary
Fields Modifier and Type Field Description static String
BASE64_PREFIX
static int
LINEBASE64_LEN
static String
LINEBASE64_SEPORATOR
-
Constructor Summary
Constructors Constructor Description HandlerBase64()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]
decode(BufferCharReader reader)
Read sequence of char Base64 from data and decode them
Stop read when non base64 char will be findstatic boolean
decode(BufferCharReader reader, OutputStream writeTo)
Read sequence of char Base64 from readFrom and decode them
Stop read when non base64 char will be findstatic byte[]
decode(String data)
Read sequence of char Base64 from data and decode them
Stop read when non base64 char will be findstatic String
encode(byte[] data, int lenStr, String lineSeparator)
Encode bytes from data to base64static boolean
encode(byte[] data, OutputStreamWriter writeTo, int lenStr, String lineSeparator)
Encode bytes from data to base64static String
encode(InputStream readFrom, int lenStr, String lineSeparator)
Encode bytes from readFrom to base64
Stop read when non base64 char will be findstatic boolean
encode(InputStream readFrom, OutputStreamWriter writeTo, int lenStr, String lineSeparator)
Encode bytes from readFrom to base64 For end line don't put separator
-
-
-
Field Detail
-
LINEBASE64_LEN
public static final int LINEBASE64_LEN
- See Also:
- Constant Field Values
-
LINEBASE64_SEPORATOR
public static final String LINEBASE64_SEPORATOR
- See Also:
- Constant Field Values
-
BASE64_PREFIX
public static final String BASE64_PREFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
decode
public static byte[] decode(BufferCharReader reader)
Read sequence of char Base64 from data and decode them
Stop read when non base64 char will be find- Parameters:
reader
- read from it base64 chars- Returns:
- decoded bytes
-
decode
public static boolean decode(BufferCharReader reader, OutputStream writeTo)
Read sequence of char Base64 from readFrom and decode them
Stop read when non base64 char will be find- Parameters:
reader
- read from it base64 charswriteTo
- write ti it decoded bytes- Returns:
- true, if decode
-
decode
public static byte[] decode(String data)
Read sequence of char Base64 from data and decode them
Stop read when non base64 char will be find- Parameters:
data
- read from it base64 chars.- Returns:
- decoded bytes
-
encode
public static boolean encode(InputStream readFrom, OutputStreamWriter writeTo, int lenStr, String lineSeparator)
Encode bytes from readFrom to base64 For end line don't put separator- Parameters:
readFrom
-writeTo
- base64 bytes are written therelenStr
- number of chars of base64 in one string. Must belenStr % 4 == 0
iflenStr == 0
then only one linelineSeparator
- sequence of chars derived strings. Separator must be contains non base64 bytes- Returns:
- true, if encode
-
encode
public static boolean encode(byte[] data, OutputStreamWriter writeTo, int lenStr, String lineSeparator)
Encode bytes from data to base64- Parameters:
data
-writeTo
- base64 bytes are written therelenStr
- number of chars of base64 in one stringlineSeparator
- sequence of chars derived strings. Separator must be contains non base64 bytes- Returns:
- true, if encode
-
encode
public static String encode(InputStream readFrom, int lenStr, String lineSeparator)
Encode bytes from readFrom to base64
Stop read when non base64 char will be find- Parameters:
readFrom
-lenStr
- number of chars of base64 in one stringlineSeparator
- sequence of chars derived strings. Separator must be contains non base64 bytes- Returns:
- base64 bytes in String
-
encode
public static String encode(byte[] data, int lenStr, String lineSeparator)
Encode bytes from data to base64- Parameters:
data
-lenStr
- number of chars of base64 in one stringlineSeparator
- sequence of chars derived strings. Separator must be contains non base64 bytes- Returns:
- base64 bytes in String
-
-