Skip to main content

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​
NAMETYPEDESCRIPTION
arrayjava.lang.ObjectArray 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​
NAMETYPEDESCRIPTION
textstringText 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​
NAMETYPEDESCRIPTION
textstringText content.
charsetstringCharacter 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​
NAMETYPEDESCRIPTION
contentbyte[]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​
NAMETYPEDESCRIPTION
contentstringContent 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​
NAMETYPEDESCRIPTION
contentbyte[]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​
NAMETYPEDESCRIPTION
contentstringContent 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​
NAMETYPEDESCRIPTION
contentstringContent 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​
NAMETYPEDESCRIPTION
contentstringContent to be converted.
Return​

( string )

Text with encoding of special characters in JSON transformed to normal text.


safeFileName​


_convert.safeFileName(fileName: string) : string​

Description​

Filename that will be converted to ensure security.

Attributes​
NAMETYPEDESCRIPTION
fileNamestringFilename that will be converted to ensure security.
Return​

( string )

Safe file name.


safePath​


_convert.safePath(path: string) : string​

Description​

Ensures that it is safe to use as a path in the file system or URL, converts \ to /.

Attributes​
NAMETYPEDESCRIPTION
pathstringThe path will be converted to ensure safety.
Return​

( string )

Safe path.


safeSystemPath​


_convert.safeSystemPath(path: string) : string​

Description​

Ensures that it is safe to use as a file path in the system, adapting the / or \ to the correct operating system format.

Attributes​
NAMETYPEDESCRIPTION
pathstringThe path system will be converted to ensure safety.
Return​

( string )

Safe system path.


slug​


_convert.slug(text: string) : string​

Description​

Converts the text to be safely injected into the URL, used to describe the page content in SEO.

Attributes​
NAMETYPEDESCRIPTION
textstringContent that will be converted.
Return​

( string )

Safe text to use in URLs.


stripAccents​


_convert.stripAccents(text: string) : string​

Description​

Replace accents with the corresponding unaccented letter.

Attributes​
NAMETYPEDESCRIPTION
textstringContent that will be converted.
Return​

( string )

Text without accents.


textFromBytes​


_convert.textFromBytes(bytes: byte[]) : string​

Description​

Converts a byte array to text.

Attributes​
NAMETYPEDESCRIPTION
bytesbyte[]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​
NAMETYPEDESCRIPTION
bytesbyte[]Byte array.
charsetstringCharacter 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​
NAMETYPEDESCRIPTION
contentbyte[]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​
NAMETYPEDESCRIPTION
contentstringContent 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​
NAMETYPEDESCRIPTION
contentbyte[]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​
NAMETYPEDESCRIPTION
contentstringContent 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​
NAMETYPEDESCRIPTION
valueintValue 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​
NAMETYPEDESCRIPTION
valuelongValue 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​
NAMETYPEDESCRIPTION
valueshortValue to be converted.
Return​

( byte )

Returns the value received in byte.


toCharset​


_convert.toCharset(name: string) : java.nio.charset.Charset​

Description​

Retrieves the object that represents a Java character encoding type.

Attributes​
NAMETYPEDESCRIPTION
namestringName or code of the character encoding type.
Return​

( java.nio.charset.Charset )

Returns the object that represents a character encoding type.


toDouble​


_convert.toDouble(value: byte) : double​

Description​

Converts the received value to double.

How To Use​
_convert.toDouble(3456)
Attributes​
NAMETYPEDESCRIPTION
valuebyteValue 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​
NAMETYPEDESCRIPTION
valuefloatValue 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​
NAMETYPEDESCRIPTION
valueintValue 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​
NAMETYPEDESCRIPTION
valuelongValue 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​
NAMETYPEDESCRIPTION
valueshortValue 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​
NAMETYPEDESCRIPTION
objectjava.lang.ObjectObject 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​
NAMETYPEDESCRIPTION
objectjava.lang.ObjectObject 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​
NAMETYPEDESCRIPTION
fileNamestringName of the file.
contentTypestringType of content.
bytesbyte[]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​
NAMETYPEDESCRIPTION
valuebyteValue 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​
NAMETYPEDESCRIPTION
valuedoubleValue 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​
NAMETYPEDESCRIPTION
valueintValue 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​
NAMETYPEDESCRIPTION
valuelongValue 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​
NAMETYPEDESCRIPTION
valueshortValue 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​
NAMETYPEDESCRIPTION
bytesbyte[]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​
NAMETYPEDESCRIPTION
contentstringContent 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​
NAMETYPEDESCRIPTION
bytesbyte[]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​
NAMETYPEDESCRIPTION
valuebyteValue 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​
NAMETYPEDESCRIPTION
valuedoubleValue 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​
NAMETYPEDESCRIPTION
valuefloatValue 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​
NAMETYPEDESCRIPTION
valuelongValue 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​
NAMETYPEDESCRIPTION
valueshortValue 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​
NAMETYPEDESCRIPTION
contentstringContent 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​
NAMETYPEDESCRIPTION
valuebyteValue 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​
NAMETYPEDESCRIPTION
valuedoubleValue 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​
NAMETYPEDESCRIPTION
valuefloatValue 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​
NAMETYPEDESCRIPTION
valueintValue 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​
NAMETYPEDESCRIPTION
valueshortValue 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​
NAMETYPEDESCRIPTION
objectjava.lang.ObjectObject 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​
NAMETYPEDESCRIPTION
valuebyteValue 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​
NAMETYPEDESCRIPTION
valueintValue 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​
NAMETYPEDESCRIPTION
valuelongValue 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​
NAMETYPEDESCRIPTION
objectjava.lang.ObjectObject 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​
NAMETYPEDESCRIPTION
valuestringString with content in the UUID format.
Return​

( java.util.UUID )

Object of the started UUID.