Package ai.djl.ndarray
Interface BytesSupplier
-
- All Known Subinterfaces:
LazyNDArray,NDArray,SparseNDArray
- All Known Implementing Classes:
CategoryMask,ChunkedBytesSupplier,Classifications,DetectedObjects,IteratorBytesSupplier,NDArrayAdapter,NDList,PublisherBytesSupplier
public interface BytesSupplierRepresents a supplier ofbyte[].
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default byte[]getAsBytes()Returns thebyte[]presentation of the object.default java.lang.ObjectgetAsObject()Returns the object that backs thisBytesSupplier.default java.lang.StringgetAsString()Returns theStringpresentation of the object.java.nio.ByteBuffertoByteBuffer()Returns theByteBufferpresentation of the object.static BytesSupplierwrap(byte[] buf)Wraps a byte array into a {code BytesSupplier}.static BytesSupplierwrap(java.lang.String value)Wraps a string into a {code BytesSupplier}.static BytesSupplierwrapAsJson(java.lang.Object object)Wraps an object as json into a {code BytesSupplier}.
-
-
-
Method Detail
-
getAsBytes
default byte[] getAsBytes()
Returns thebyte[]presentation of the object.- Returns:
- the
byte[]presentation of the object
-
getAsString
default java.lang.String getAsString()
Returns theStringpresentation of the object.- Returns:
- the
Stringpresentation of the object
-
getAsObject
default java.lang.Object getAsObject()
Returns the object that backs thisBytesSupplier.- Returns:
- the object that backs this
BytesSupplier
-
toByteBuffer
java.nio.ByteBuffer toByteBuffer()
Returns theByteBufferpresentation of the object.- Returns:
- the
ByteBufferpresentation of the object
-
wrap
static BytesSupplier wrap(byte[] buf)
Wraps a byte array into a {code BytesSupplier}.- Parameters:
buf- the byte array that will back this {code BytesSupplier}- Returns:
- a
BytesSupplier
-
wrap
static BytesSupplier wrap(java.lang.String value)
Wraps a string into a {code BytesSupplier}.- Parameters:
value- the string that will back this {code BytesSupplier}- Returns:
- a
BytesSupplier
-
wrapAsJson
static BytesSupplier wrapAsJson(java.lang.Object object)
Wraps an object as json into a {code BytesSupplier}.- Parameters:
object- the object that will back this {code BytesSupplier}- Returns:
- a
BytesSupplier
-
-