Convert
Application data type converter.
arrayToList
_convert.arrayToList(array: java.lang.Object) : java.util.List
Description
Converts an array of primitive types to a list (collection).
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
array | java.lang.Object | Array that will be converted into a list (collection). |
Return
( java.util.List )
New list with all array elements.
bytesFromText
_convert.bytesFromText(text: string) : byte[]
Description
Converts a text to byte array.
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
text | string | Text content. |
Return
( byte[] )
Returns the byte array obtained from text.
_convert.bytesFromText(text: string, charset: string) : byte[]
Description
Converts a text to byte array.
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
text | string | Text content. |
charset | string | Character encoding code. |
Return
( byte[] )
Returns the byte array obtained from text.
fromBase64
_convert.fromBase64(content: byte[]) : string
Description
Converts Base64 content to a decoded string.
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
content | byte[] | Content to be converted. |
Return
( string )
Returns the decoded string that was in Base64.
_convert.fromBase64(content: string) : string
Description
Converts Base64 content to a decoded string.
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
content | string | Content to be converted. |
Return
( string )
Returns the decoded string that was in Base64.
fromBase64AsBytes
_convert.fromBase64AsBytes(content: byte[]) : byte[]
Description
Converts the Base64 content to the original decoded byte array.
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
content | byte[] | Content to be converted. |
Return
( byte[] )
Returns decoded bytes that were in Base64.
_convert.fromBase64AsBytes(content: string) : byte[]
Description
Converts the Base64 content to the original decoded byte array.
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
content | string | Content to be converted. |
Return
( byte[] )
Returns decoded bytes that were in Base64.
fromHTML
_convert.fromHTML(content: string) : string
Description
Transforms the encoding of special HTML characters to plain text.
How To Use
// Will print: €s Ação
_out.print(_convert.fromHTML("€s Ação"))
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
content | string | Content to be converted. |
Return
( string )
Text with encoding of special characters in HTML transformed to normal text.
fromJSON
_convert.fromJSON(content: string) : string
Description
Transforms the encoding of special characters from JSON to normal text.
How To Use
// Will print: €s Ação
_out.print(_convert.toJSON("\u20ACs A\u00E7\u00E3o"))
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
content | string | Content to be converted. |
Return
( string )
Text with encoding of special characters in JSON transformed to normal text.
textFromBytes
_convert.textFromBytes(bytes: byte[]) : string
Description
Converts a byte array to text.
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
bytes | byte[] | Byte array. |
Return
( string )
Returns the text obtained from the byte array.
_convert.textFromBytes(bytes: byte[], charset: string) : string
Description
Converts a byte array to text.
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
bytes | byte[] | Byte array. |
charset | string | Character encoding code. |
Return
( string )
Returns the text obtained from the byte array.
toBase64
_convert.toBase64(content: byte[]) : string
Description
Converts the content to a Base64 encoded string.
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
content | byte[] | Content to be converted. |
Return
( string )
Returns the encoded string in Base64.
_convert.toBase64(content: string) : string
Description
Converts the content to a Base64 encoded string.
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
content | string | Content to be converted. |
Return
( string )
Returns the encoded string in Base64.
toBase64AsBytes
_convert.toBase64AsBytes(content: byte[]) : byte[]
Description
Converts the content to a Base64 encoded string.
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
content | byte[] | Content to be converted. |
Return
( byte[] )
Returns the encoded string in Base64.
_convert.toBase64AsBytes(content: string) : byte[]
Description
Convert the content into Base64 encoding.
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
content | string | Content to be converted. |
Return
( byte[] )
Returns Base64 encoded bytes.
toByte
_convert.toByte(value: int) : byte
Description
Converts the received value to byte.
How To Use
_convert.toByte(3456)
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
value | int | Value to be converted. |
Return
( byte )
Returns the value received in byte.
_convert.toByte(value: long) : byte
Description
Converts the received value to byte.
How To Use
_convert.toByte(3456)
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
value | long | Value to be converted. |
Return
( byte )
Returns the value received in byte.
_convert.toByte(value: short) : byte
Description
Converts the received value to byte.
How To Use
_convert.toByte(3456)
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
value | short | Value to be converted. |
Return
( byte )
Returns the value received in byte.
toDouble
_convert.toDouble(value: byte) : double
Description
Converts the received value to double.
How To Use
_convert.toDouble(3456)
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
value | byte | Value to be converted. |
Return
( double )
Retorna o valor recebido em double.
_convert.toDouble(value: float) : double
Description
Converts the received value to double.
How To Use
_convert.toDouble(3456)
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
value | float | Value to be converted. |
Return
( double )
Retorna o valor recebido em double.
_convert.toDouble(value: int) : double
Description
Converts the received value to double.
How To Use
_convert.toDouble(3456)
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
value | int | Value to be converted. |
Return
( double )
Retorna o valor recebido em double.
_convert.toDouble(value: long) : double
Description
Converts the received value to double.
How To Use
_convert.toDouble(3456)
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
value | long | Value to be converted. |
Return
( double )
Retorna o valor recebido em double.
_convert.toDouble(value: short) : double
Description
Converts the received value to double.
How To Use
_convert.toDouble(3456)
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
value | short | Value to be converted. |
Return
( double )
Retorna o valor recebido em double.
toError
_convert.toError(object: java.lang.Object) : java.lang.Error
Description
Converts the received object to an Error object.
How To Use
const originalError = _error.createError("Serious failure.")
const generic = _convert.toObject(originalError)
const backAsError = _convert.toError(generic)
if (_error.isError(backAsError)) {
_error.info("It is really a serious failure...")
}
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
object | java.lang.Object | Object to be converted. |
Return
( java.lang.Error )
Returns the object converted as Error.
toException
_convert.toException(object: java.lang.Object) : java.lang.Exception
Description
Converts the received object to an Exception object.
How To Use
const originalException = _error.createException("Serious failure.")
const generic = _convert.toObject(originalException)
const backAsException = _convert.toException(generic)
if (_error.isException(backAsException)) {
_error.info("It is really a serious failure...")
}
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
object | java.lang.Object | Object to be converted. |
Return
( java.lang.Exception )
Returns the object converted as Exception.
toFile
_convert.toFile(fileName: string, contentType: string, bytes: byte[]) : File
Description
Starts a file object in memory with the contents of the received bytes.
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
fileName | string | Name of the file. |
contentType | string | Type of content. |
bytes | byte[] | Bytes that represent the file content. |
Return
( File )
Object of the started file that allows the manipulation of bytes as a file.
toFloat
_convert.toFloat(value: byte) : float
Description
Converts the received value to float.
How To Use
_convert.toFloat(3456)
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
value | byte | Value to be converted. |
Return
( float )
Retorna o valor recebido em float.
_convert.toFloat(value: double) : float
Description
Converts the received value to float.
How To Use
_convert.toFloat(3456)
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
value | double | Value to be converted. |
Return
( float )
Retorna o valor recebido em float.
_convert.toFloat(value: int) : float
Description
Converts the received value to float.
How To Use
_convert.toFloat(3456)
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
value | int | Value to be converted. |
Return
( float )
Retorna o valor recebido em float.
_convert.toFloat(value: long) : float
Description
Converts the received value to float.
How To Use
_convert.toFloat(3456)
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
value | long | Value to be converted. |
Return
( float )
Retorna o valor recebido em float.
_convert.toFloat(value: short) : float
Description
Converts the received value to float.
How To Use
_convert.toFloat(3456)
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
value | short | Value to be converted. |
Return
( float )
Retorna o valor recebido em float.
toHEX
_convert.toHEX(bytes: byte[]) : string
Description
Convert bytes to hexadecimal with uppercase letters.
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
bytes | byte[] | Bytes to be converted. |
Return
( string )
Return bytes received in hexadecimal in capital letters.
toHTML
_convert.toHTML(content: string) : string
Description
Converts special characters in the text to ensure that they are valid in HTML.
How To Use
// Will print: €s Ação
_out.print(_convert.toHTML("€s Ação"))
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
content | string | Content to be converted. |
Return
( string )
Text formatted with encoding of special characters in HTML.
toHex
_convert.toHex(bytes: byte[]) : string
Description
Convert bytes to hexadecimal with lowercase letters.
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
bytes | byte[] | Bytes to be converted. |
Return
( string )
Return bytes received in hexadecimal in lowercase.
toInt
_convert.toInt(value: byte) : int
Description
Converts the received value to int.
How To Use
_convert.toInt(3456)
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
value | byte | Value to be converted. |
Return
( int )
Retorna o valor recebido em int.
_convert.toInt(value: double) : int
Description
Converts the received value to int.
How To Use
_convert.toInt(3456)
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
value | double | Value to be converted. |
Return
( int )
Retorna o valor recebido em int.
_convert.toInt(value: float) : int
Description
Converts the received value to int.
How To Use
_convert.toInt(3456)
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
value | float | Value to be converted. |
Return
( int )
Retorna o valor recebido em int.
_convert.toInt(value: long) : int
Description
Converts the received value to int.
How To Use
_convert.toInt(3456)
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
value | long | Value to be converted. |
Return
( int )
Retorna o valor recebido em int.
_convert.toInt(value: short) : int
Description
Converts the received value to int.
How To Use
_convert.toInt(3456)
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
value | short | Value to be converted. |
Return
( int )
Retorna o valor recebido em int.
toJSON
_convert.toJSON(content: string) : string
Description
Converts special characters in the text to ensure that they are valid in JSON.
How To Use
// Will print: \u20ACs A\u00E7\u00E3o
_out.print(_convert.toJSON("€s Ação"))
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
content | string | Content to be converted. |
Return
( string )
Text formatted with encoding of special characters in JSON.
toLong
_convert.toLong(value: byte) : long
Description
Converts the received value to long.
How To Use
_convert.toLong(3456)
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
value | byte | Value to be converted. |
Return
( long )
Retorna o valor recebido em long.
_convert.toLong(value: double) : long
Description
Converts the received value to long.
How To Use
_convert.toLong(3456)
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
value | double | Value to be converted. |
Return
( long )
Retorna o valor recebido em long.
_convert.toLong(value: float) : long
Description
Converts the received value to long.
How To Use
_convert.toLong(3456)
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
value | float | Value to be converted. |
Return
( long )
Retorna o valor recebido em long.
_convert.toLong(value: int) : long
Description
Converts the received value to long.
How To Use
_convert.toLong(3456)
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
value | int | Value to be converted. |
Return
( long )
Retorna o valor recebido em long.
_convert.toLong(value: short) : long
Description
Converts the received value to long.
How To Use
_convert.toLong(3456)
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
value | short | Value to be converted. |
Return
( long )
Retorna o valor recebido em long.
toObject
_convert.toObject(object: java.lang.Object) : java.lang.Object
Description
Converts the received object to a generic object type.
How To Use
const genericObject = _convert.toObject("Text...")
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
object | java.lang.Object | Object to be converted. |
Return
( java.lang.Object )
Returns as type of generic object.
toShort
_convert.toShort(value: byte) : short
Description
Converts the received value to short.
How To Use
_convert.toShort(3456)
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
value | byte | Value to be converted. |
Return
( short )
Returns the value received in short.
_convert.toShort(value: int) : short
Description
Converts the received value to short.
How To Use
_convert.toShort(3456)
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
value | int | Value to be converted. |
Return
( short )
Returns the value received in short.
_convert.toShort(value: long) : short
Description
Converts the received value to short.
How To Use
_convert.toShort(3456)
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
value | long | Value to be converted. |
Return
( short )
Returns the value received in short.
toThrowable
_convert.toThrowable(object: java.lang.Object) : java.lang.Throwable
Description
Converts the received object into a Throwable type error.
How To Use
const error = _error.createError("Serious failure.")
const asThrowable = _convert.toThrowable(erro)
_error.rise(asThrowable)
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
object | java.lang.Object | Object to be converted. |
Return
( java.lang.Throwable )
Returns the Throwable type error.
toUUID
_convert.toUUID(value: string) : java.util.UUID
Description
Inicia um objeto de UUID com o conteúdo recebido.
Attributes
NAME | TYPE | DESCRIPTION |
---|---|---|
value | string | String with content in the UUID format. |
Return
( java.util.UUID )
Object of the started UUID.