public class Input
extends java.lang.Object
Constructor and Description |
---|
Input()
Constructs a new
Input instance. |
Modifier and Type | Method and Description |
---|---|
void |
add(byte[] data)
Appends an item at the end of the input.
|
void |
add(BytesSupplier data)
Appends an item at the end of the input.
|
void |
add(int index,
java.lang.String key,
BytesSupplier data)
Inserts the specified element at the specified position in the input.
|
void |
add(java.lang.String data)
Appends an item at the end of the input.
|
void |
add(java.lang.String key,
byte[] data)
Adds a key/value pair to the input content.
|
void |
add(java.lang.String key,
BytesSupplier data)
Adds a key/value pair to the input content.
|
void |
add(java.lang.String key,
java.lang.String data)
Adds a key/value pair to the input content.
|
void |
addProperty(java.lang.String key,
java.lang.String value)
Adds a property to the input.
|
BytesSupplier |
get(int index)
Returns the element at the specified position in the
Input . |
BytesSupplier |
get(java.lang.String key)
Returns the element for the first key found in the
Input . |
byte[] |
getAsBytes(int index)
Returns the value as
byte[] at the specified position in the Input . |
byte[] |
getAsBytes(java.lang.String key)
Returns the value as
byte[] for the first key found in the Input . |
NDArray |
getAsNDArray(NDManager manager,
int index)
Returns the value as
NDArray at the specified position in the Input . |
NDArray |
getAsNDArray(NDManager manager,
java.lang.String key)
Returns the value as
NDArray for the first key found in the Input . |
NDList |
getAsNDList(NDManager manager,
int index)
Returns the value as
NDList at the specified position in the Input . |
NDList |
getAsNDList(NDManager manager,
java.lang.String key)
Returns the value as
NDList for the first key found in the Input . |
java.lang.String |
getAsString(int index)
Returns the value as
byte[] at the specified position in the Input . |
java.lang.String |
getAsString(java.lang.String key)
Returns the value as
byte[] for the first key found in the Input . |
ai.djl.util.PairList<java.lang.String,BytesSupplier> |
getContent()
Returns the content of the input.
|
BytesSupplier |
getData()
Returns the default data item.
|
NDList |
getDataAsNDList(NDManager manager)
Returns the default data as
NDList . |
java.util.Map<java.lang.String,java.lang.String> |
getProperties()
Returns the properties of the input.
|
java.lang.String |
getProperty(java.lang.String key,
java.lang.String defaultValue)
Returns the value to which the specified key is mapped.
|
void |
setContent(ai.djl.util.PairList<java.lang.String,BytesSupplier> content)
Sets the content of the input.
|
void |
setProperties(java.util.Map<java.lang.String,java.lang.String> properties)
Sets the properties of the input.
|
java.lang.String |
toString()
*
|
public java.util.Map<java.lang.String,java.lang.String> getProperties()
public void setProperties(java.util.Map<java.lang.String,java.lang.String> properties)
properties
- the properties of the inputpublic void addProperty(java.lang.String key, java.lang.String value)
key
- key with which the specified value is to be addedvalue
- value to be added with the specified keypublic java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue)
key
- the key whose associated value is to be returneddefaultValue
- the default mapping of the keypublic ai.djl.util.PairList<java.lang.String,BytesSupplier> getContent()
A Input
may contains multiple data.
public void setContent(ai.djl.util.PairList<java.lang.String,BytesSupplier> content)
content
- the content of the inputpublic void add(byte[] data)
data
- data to be addedpublic void add(java.lang.String data)
data
- data to be addedpublic void add(BytesSupplier data)
data
- data to be addedpublic void add(java.lang.String key, byte[] data)
key
- key with which the specified data is to be addeddata
- data to be added with the specified keypublic void add(java.lang.String key, java.lang.String data)
key
- key with which the specified data is to be addeddata
- data to be added with the specified keypublic void add(java.lang.String key, BytesSupplier data)
key
- key with which the specified data is to be addeddata
- data to be added with the specified keypublic void add(int index, java.lang.String key, BytesSupplier data)
index
- the index at which the specified element is to be insertedkey
- key with which the specified data is to be addeddata
- data to be added with the specified keypublic BytesSupplier getData()
public NDList getDataAsNDList(NDManager manager)
NDList
.manager
- NDManager
used to create this NDArray
NDList
public BytesSupplier get(java.lang.String key)
Input
.key
- the key of the element to getInput
public BytesSupplier get(int index)
Input
.index
- the index of the element to returnInput
public byte[] getAsBytes(java.lang.String key)
byte[]
for the first key found in the Input
.key
- the key of the element to getbyte[]
for the first key found in the Input
public byte[] getAsBytes(int index)
byte[]
at the specified position in the Input
.index
- the index of the element to returnbyte[]
at the specified position in the Input
public java.lang.String getAsString(java.lang.String key)
byte[]
for the first key found in the Input
.key
- the key of the element to getbyte[]
for the first key found in the Input
public java.lang.String getAsString(int index)
byte[]
at the specified position in the Input
.index
- the index of the element to returnbyte[]
at the specified position in the Input
public NDArray getAsNDArray(NDManager manager, java.lang.String key)
NDArray
for the first key found in the Input
.manager
- NDManager
used to create this NDArray
key
- the key of the element to getNDArray
for the first key found in the Input
public NDArray getAsNDArray(NDManager manager, int index)
NDArray
at the specified position in the Input
.manager
- NDManager
used to create this NDArray
index
- the index of the element to returnNDArray
at the specified position in the Input
public NDList getAsNDList(NDManager manager, java.lang.String key)
NDList
for the first key found in the Input
.manager
- NDManager
used to create this NDArray
key
- the key of the element to getNDList
for the first key found in the Input
public NDList getAsNDList(NDManager manager, int index)
NDList
at the specified position in the Input
.manager
- NDManager
used to create this NDArray
index
- the index of the element to returnNDList
at the specified position in the Input
public java.lang.String toString()
toString
in class java.lang.Object