Binary¶
Definition¶
Extends¶
Extended By¶
None
Description¶
Binary stream of bytes
Method Summary¶
Owner | Name | Return Type | Description |
---|---|---|---|
Binary | constructor(text) | Binary | Creates a UTF binary representation of a string. If the string is null, creates an empty Binary. |
Binary | constructor(text, charset) | Binary | Creates a UTF binary representation of a string with the supplied charset (e.g, UTF-8). If string is null, creates an empty Binary |
Object | getClassName() | String | Returns the string name of this object's class type. |
Binary | getLength() | Integer | Returns number of bytes in this Binary object. |
Binary | toBase64() | String | Returns the base64 encoding of this Binary object. |
Object | toJson() | String | Returns a string of a json representation of this object. |
Binary | toText() | String | Tries to return the text representation of the supplied Binary object using the default Java charset (UTF-8). |
Binary | toText(charset) | String | Tries to return the text version of the binary using the provided Java charset. |
Method Definitions¶
constructor(text)¶
Binary binary = new Binary(String text)
Description¶
Creates a UTF binary representation of a string. If the string is null, creates an empty Binary.
Parameter Definition¶
Name | Type | Description |
---|---|---|
text | String | string value to convert to binary |
Example 1¶
constructor(text,charset)¶
Binary binary = new Binary(String text, String charset)
Description¶
Creates a UTF binary representation of a string with the supplied charset (e.g, UTF-8). If string is null, creates an empty Binary
Parameter Definition¶
Name | Type | Description |
---|---|---|
text | String | string value to convert to binary |
charset | String | charset to encode with |
Example 1¶
getClassName()¶
Description¶
Returns the string name of this object's class type.
Example 2¶
getLength()¶
Description¶
Returns number of bytes in this Binary object.
Example 1¶
toBase64()¶
Description¶
Returns the base64 encoding of this Binary object.
Example 1¶
toJson()¶
Description¶
Returns a string of a json representation of this object.
Example 2¶
toText()¶
Description¶
Tries to return the text representation of the supplied Binary object using the default Java charset (UTF-8).
Example 1¶
Example 2¶
Here the return value renders incorrectly since UTF-8 cannot parse UTF-16 correctly.
toText(charset)¶
String Binary::toText(String charset)
Description¶
Tries to return the text version of the binary using the provided Java charset.
Parameter Definition¶
Name | Type | Description |
---|---|---|
charset | String | charset to decode binary with |
Example 1¶
Here the return value renders incorrectly since UTF-16 cannot parse UTF-8 correctly.