# ShortDataLayout

public interface **ShortDataLayout** A `https://www.tensorflow.org/jvm/api_docs/java/org/tensorflow/ndarray/buffer/layout/DataLayout` that converts data stored in a buffer to shorts.

##### See Also

- `https://www.tensorflow.org/jvm/api_docs/java/org/tensorflow/ndarray/buffer/layout/DataLayout`

### Public Methods

|---|---|
| abstract [ShortDataBuffer](https://www.tensorflow.org/jvm/api_docs/java/org/tensorflow/ndarray/buffer/ShortDataBuffer) | [applyTo](https://www.tensorflow.org/jvm/api_docs/java/org/tensorflow/ndarray/buffer/layout/ShortDataLayout#applyTo(S))(S buffer) Apply this layout to the provided buffer. |
| abstract Short | [readObject](https://www.tensorflow.org/jvm/api_docs/java/org/tensorflow/ndarray/buffer/layout/ShortDataLayout#readObject(S, long))(S buffer, long index) Reads `n = scale()` values from the buffer at the given index and return them as a single value in the user type. |
| abstract short | [readShort](https://www.tensorflow.org/jvm/api_docs/java/org/tensorflow/ndarray/buffer/layout/ShortDataLayout#readShort(S, long))(S buffer, long index) Reads `n = scale()` buffer values at the given index and return them as a short. |
| abstract void | [writeObject](https://www.tensorflow.org/jvm/api_docs/java/org/tensorflow/ndarray/buffer/layout/ShortDataLayout#writeObject(S, java.lang.Short, long))(S buffer, Short value, long index) |
| abstract void | [writeShort](https://www.tensorflow.org/jvm/api_docs/java/org/tensorflow/ndarray/buffer/layout/ShortDataLayout#writeShort(S, short, long))(S buffer, short value, long index) Writes a short into the buffer at the given index after converting it to the buffer type. |

### Inherited Methods

From interface [org.tensorflow.ndarray.buffer.layout.DataLayout](https://www.tensorflow.org/jvm/api_docs/java/org/tensorflow/ndarray/buffer/layout/DataLayout)

|---|---|
| abstract [DataBuffer](https://www.tensorflow.org/jvm/api_docs/java/org/tensorflow/ndarray/buffer/DataBuffer)\<Short\> | [applyTo](https://www.tensorflow.org/jvm/api_docs/java/org/tensorflow/ndarray/buffer/layout/DataLayout#applyTo(S))(S buffer) Apply this layout to the provided buffer. |
| abstract Short | [readObject](https://www.tensorflow.org/jvm/api_docs/java/org/tensorflow/ndarray/buffer/layout/DataLayout#readObject(S, long))(S buffer, long index) Reads `n = scale()` values from the buffer at the given index and return them as a single value in the user type. |
| abstract int | [scale](https://www.tensorflow.org/jvm/api_docs/java/org/tensorflow/ndarray/buffer/layout/DataLayout#scale())() Indicates the number of buffer values are required to represent a single user value, default is 1. |
| abstract void | [writeObject](https://www.tensorflow.org/jvm/api_docs/java/org/tensorflow/ndarray/buffer/layout/DataLayout#writeObject(S, T, long))(S buffer, Short value, long index) Writes a user value into the buffer at the given index after converting it to the buffer type. |

## Public Methods

#### public abstract [ShortDataBuffer](https://www.tensorflow.org/jvm/api_docs/java/org/tensorflow/ndarray/buffer/ShortDataBuffer)
**applyTo**
(S buffer)

Apply this layout to the provided buffer.

The returned `https://www.tensorflow.org/jvm/api_docs/java/org/tensorflow/ndarray/buffer/DataBuffer` instance is simply a wrapper to the original buffer and does
not have a backing storage of his own.

<br />

##### Parameters

| buffer | the target buffer to apply this layout to |
|---|---|

##### Returns

- a buffer with this layout

#### public abstract Short
**readObject**
(S buffer, long index)

Reads `n = scale()` values from the buffer at the given index and return them as a single
value in the user type.

It is the responsibility of the implementors of this interface to read the value to be
converted from the given buffer, using the most appropriate method. For example, for a layout
that converting a single `long` to a `BigInteger`,

```
 @Override
 public BigInteger readObject(LongDataBuffer buffer, long index) {
   return BigInteger.valueOf(buffer.getLong(index));
 }
 
```
If a single user value scales over more than one buffer values, `index` indicates the starting position of the sequence to be read from the buffer.

<br />

<br />

##### Parameters

| buffer | the buffer to read from |
| index | position of the buffer to read in the buffer |
|---|---|

##### Returns

- the converted value

#### public abstract short
**readShort**
(S buffer, long index)

Reads `n = scale()` buffer values at the given index and return them as a short.

##### Parameters

| buffer | the buffer to read from |
| index | position of the value to read in the buffer |
|---|---|

##### Returns

- the short value

##### See Also

- `https://www.tensorflow.org/jvm/api_docs/java/org/tensorflow/ndarray/buffer/layout/ShortDataLayout#readObject(S, long)`

#### public abstract void
**writeObject**
(S buffer, Short value, long index)

<br />

#### public abstract void
**writeShort**
(S buffer, short value, long index)

Writes a short into the buffer at the given index after converting it to the buffer type.

##### Parameters

| buffer | the buffer to write to |
| value | the short to convert and write |
| index | index in the buffer where the converted value should be written |
|---|---|

##### See Also

- `https://www.tensorflow.org/jvm/api_docs/java/org/tensorflow/ndarray/buffer/layout/ShortDataLayout#writeObject(S, java.lang.Short, long)`