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 Object
Returns the object that backs thisBytesSupplier
.default String
Returns theString
presentation of the object.Returns theByteBuffer
presentation of the object.static BytesSupplier
wrap
(byte[] buf) Wraps a byte array into a {code BytesSupplier}.static BytesSupplier
Wraps a string into a {code BytesSupplier}.static BytesSupplier
wrapAsJson
(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 theString
presentation of the object.- Returns:
- the
String
presentation of the object
-
getAsObject
Returns the object that backs thisBytesSupplier
.- Returns:
- the object that backs this
BytesSupplier
-
toByteBuffer
ByteBuffer toByteBuffer()Returns theByteBuffer
presentation of the object.- Returns:
- the
ByteBuffer
presentation 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
-