Groovy JDK

primitive-types
Class byte[]

Method Summary
void eachByte(Closure closure)
Traverse through each byte of this byte array
Writable encodeBase64(boolean chunked)
Produce a Writable object which writes the Base64 encoding of the byte array Calling toString() on the result returns the encoding as a String information on Base64 encoding and chunking see RFC 4648
Writable encodeBase64()
Produce a Writable object which writes the Base64 encoding of the byte array Calling toString() on the result returns the encoding as a String information on Base64 encoding and chunking see RFC 4648
Object getAt(Range range)
Support the subscript operator with a range for a byte array
Object getAt(IntRange range)
Support the subscript operator with an IntRange for a byte array
Object getAt(ObjectRange range)
Support the subscript operator with an ObjectRange for a byte array
Object getAt(Collection indices)
Support the subscript operator with a collection for a byte array
int size()
Allows arrays to behave similar to collections
List toList()
Converts this array to a List of the same size, with each element added to the list
 
Method Detail

eachByte

public void eachByte(Closure closure)
Traverse through each byte of this byte array. Alias for each.

Parameters:
closure - a closure.
See:
#each(Object,Closure).

encodeBase64

public Writable encodeBase64(boolean chunked)
Produce a Writable object which writes the Base64 encoding of the byte array. Calling toString() on the result returns the encoding as a String. For more information on Base64 encoding and chunking see RFC 4648.

Parameters:
chunked - whether or not the Base64 encoded data should be MIME chunked.
Returns:
object which will write the Base64 encoding of the byte array

encodeBase64

public Writable encodeBase64()
Produce a Writable object which writes the Base64 encoding of the byte array. Calling toString() on the result returns the encoding as a String. For more information on Base64 encoding and chunking see RFC 4648.

Returns:
object which will write the Base64 encoding of the byte array

getAt

public Object getAt(Range range)
Support the subscript operator with a range for a byte array

Parameters:
range - a range indicating the indices for the items to retrieve.
Returns:
list of the retrieved bytes

getAt

public Object getAt(IntRange range)
Support the subscript operator with an IntRange for a byte array

Parameters:
range - an IntRange indicating the indices for the items to retrieve.
Returns:
list of the retrieved bytes

getAt

public Object getAt(ObjectRange range)
Support the subscript operator with an ObjectRange for a byte array

Parameters:
range - an ObjectRange indicating the indices for the items to retrieve.
Returns:
list of the retrieved bytes

getAt

public Object getAt(Collection indices)
Support the subscript operator with a collection for a byte array

Parameters:
indices - a collection of indices for the items to retrieve.
Returns:
list of the bytes at the given indices

size

public int size()
Allows arrays to behave similar to collections.

Returns:
the length of the array
See:
Array#getLength(Object).

toList

public List toList()
Converts this array to a List of the same size, with each element added to the list.

Returns:
a list containing the contents of this array.

Groovy JDK