Package ai.djl.ndarray
Interface BytesSupplier
- All Known Subinterfaces:
LazyNDArray,NDArray,SparseNDArray
- All Known Implementing Classes:
CategoryMask,ChunkedBytesSupplier,Classifications,DetectedObjects,IteratorBytesSupplier,Landmark,Mask,NDArrayAdapter,NDList,PublisherBytesSupplier,Rectangle
public interface BytesSupplier
Represents a supplier of
byte[].-
Method Summary
Modifier and TypeMethodDescriptiondefault byte[]Returns thebyte[]presentation of the object.default ObjectReturns the object that backs thisBytesSupplier.default StringReturns theStringpresentation of the object.Returns theByteBufferpresentation of the object.static BytesSupplierwrap(byte[] buf) Wraps a byte array into a {code BytesSupplier}.static BytesSupplierWraps a string into a {code BytesSupplier}.static BytesSupplierwrapAsJson(Object object) Wraps an object as json into a {code BytesSupplier}.
-
Method Details
-
getAsBytes
default byte[] getAsBytes()Returns thebyte[]presentation of the object.- Returns:
- the
byte[]presentation of the object
-
getAsString
Returns theStringpresentation of the object.- Returns:
- the
Stringpresentation of the object
-
getAsObject
Returns the object that backs thisBytesSupplier.- Returns:
- the object that backs this
BytesSupplier
-
toByteBuffer
ByteBuffer toByteBuffer()Returns theByteBufferpresentation of the object.- Returns:
- the
ByteBufferpresentation of the object
-
wrap
Wraps a byte array into a {code BytesSupplier}.- Parameters:
buf- the byte array that will back this {code BytesSupplier}- Returns:
- a
BytesSupplier
-
wrap
Wraps a string into a {code BytesSupplier}.- Parameters:
value- the string that will back this {code BytesSupplier}- Returns:
- a
BytesSupplier
-
wrapAsJson
Wraps an object as json into a {code BytesSupplier}.- Parameters:
object- the object that will back this {code BytesSupplier}- Returns:
- a
BytesSupplier
-