# Class Struct.Data

java.lang.Object
mpi.Struct.Data

Direct Known Subclasses:
  `DoubleInt.Data, FloatInt.Data, Int2.Data, LongInt.Data, ShortInt.Data`

Enclosing class:
  `Struct`

public abstract class Struct.Data extends Object
Base class for reading/writing data in a struct stored in a byte buffer.

## Constructor Summary

Constructors
Constructor
Description
`Data()`

## Method Summary

Modifier and Type
Method
Description
`final ByteBuffer`
`getBuffer()`
Gets the buffer where this struct data is stored.
`protected final ByteBuffer`
`getBuffer(Datatype type, int field)`
Gets the buffer of a field.
`protected final ByteBuffer`
`getBuffer(Datatype type, int field, int index)`
Gets the buffer data at the specified position of a buffer array.
`protected final byte`
`getByte(int field)`
Gets the byte value of a field.
`protected final byte`
`getByte(int field, int index)`
Gets the byte value at the specified position of a byte array.
`protected final char`
`getChar(int field)`
Gets the char value of a field.
`protected final char`
`getChar(int field, int index)`
Gets the char value at the specified position of a char array.
`protected final <S extends Struct, D extends Struct.Data>
D`
`getData(S struct, int field)`
`protected final <S extends Struct, D extends Struct.Data>
D`
`getData(S struct, int field, int index)`
`protected final double`
`getDouble(int field)`
Gets the double value of a field.
`protected final double`
`getDouble(int field, int index)`
Gets the double value at the specified position of a double array.
`protected final float`
`getFloat(int field)`
Gets the float value of a field.
`protected final float`
`getFloat(int field, int index)`
Gets the float value at the specified position of a float array.
`protected final int`
`getInt(int field)`
Gets the int value of a field.
`protected final int`
`getInt(int field, int index)`
Gets the int value at the specified position of an int array.
`protected final long`
`getLong(int field)`
Gets the long value of a field.
`protected final long`
`getLong(int field, int index)`
Gets the long value at the specified position of a long array.
`protected final short`
`getShort(int field)`
Gets the short value of a field.
`protected final short`
`getShort(int field, int index)`
Gets the short value at the specified position of a short array.
`protected final void`
`putByte(int field, byte v)`
Puts a byte value in a field.
`protected final void`
`putByte(int field, int index, byte v)`
Puts a byte value at the specified position of a byte array.
`protected final void`
`putChar(int field, char v)`
Puts a char value in a field.
`protected final void`
`putChar(int field, int index, char v)`
Puts a char value at the specified position of a char array.
`protected final void`
`putDouble(int field, double v)`
Puts a double value in a field.
`protected final void`
`putDouble(int field, int index, double v)`
Puts a double value at the specified position of a double array.
`protected final void`
`putFloat(int field, float v)`
Puts a float value in a field.
`protected final void`
`putFloat(int field, int index, float v)`
Puts a float value at the specified position of a float array.
`protected final void`
`putInt(int field, int v)`
Puts an int value in a field.
`protected final void`
`putInt(int field, int index, int v)`
Puts an int value at the specified position of an int array.
`protected final void`
`putLong(int field, int index, long v)`
Puts a long value at the specified position of a long array.
`protected final void`
`putLong(int field, long v)`
Puts a long value in a field.
`protected final void`
`putShort(int field, int index, short v)`
Puts a short value at the specified position of a short array.
`protected final void`
`putShort(int field, short v)`
Puts a short value in a field.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### Data

public Data()

## Method Details

### getBuffer

public final ByteBuffer getBuffer()
Gets the buffer where this struct data is stored.

The buffer can be used in `send`/`recv` operations.

Returns:
  Buffer where the struct data is stored.

### getByte

protected final byte getByte(int field)
Gets the byte value of a field.

Parameters:
  `field` - Offset of the field.
Returns:
  Byte value.

### getByte

protected final byte getByte(int field, int index)
Gets the byte value at the specified position of a byte array.

Parameters:
  `field` - Offset of the byte array.
  `index` - Index of the byte in the array.
Returns:
  Byte value.

### putByte

protected final void putByte(int field, byte v)
Puts a byte value in a field.

Parameters:
  `field` - Offset of the field.
  `v` - Byte value.

### putByte

protected final void putByte(int field, int index, byte v)
Puts a byte value at the specified position of a byte array.

Parameters:
  `field` - Offset of the byte array.
  `index` - Index of the byte in the array.
  `v` - Byte value.

### getChar

protected final char getChar(int field)
Gets the char value of a field.

Parameters:
  `field` - Offset of the field.
Returns:
  Char value.

### getChar

protected final char getChar(int field, int index)
Gets the char value at the specified position of a char array.

Parameters:
  `field` - Offset of the char array.
  `index` - Index of the char in the array.
Returns:
  Char value.

### putChar

protected final void putChar(int field, char v)
Puts a char value in a field.

Parameters:
  `field` - Offset of the field.
  `v` - Char value.

### putChar

protected final void putChar(int field, int index, char v)
Puts a char value at the specified position of a char array.

Parameters:
  `field` - Offset of the char array.
  `index` - Index of the char in the array.
  `v` - Char value.

### getShort

protected final short getShort(int field)
Gets the short value of a field.

Parameters:
  `field` - Offset of the field.
Returns:
  Short value.

### getShort

protected final short getShort(int field, int index)
Gets the short value at the specified position of a short array.

Parameters:
  `field` - Offset of the short array.
  `index` - Index of the short in the array.
Returns:
  Short value.

### putShort

protected final void putShort(int field, short v)
Puts a short value in a field.

Parameters:
  `field` - Offset of the field.
  `v` - Short value.

### putShort

protected final void putShort(int field, int index, short v)
Puts a short value at the specified position of a short array.

Parameters:
  `field` - Offset of the short array.
  `index` - Index of the short in the array.
  `v` - Short value.

### getInt

protected final int getInt(int field)
Gets the int value of a field.

Parameters:
  `field` - Offset of the field.
Returns:
  Int value.

### getInt

protected final int getInt(int field, int index)
Gets the int value at the specified position of an int array.

Parameters:
  `field` - Offset of the int array.
  `index` - Index of the int in the array.
Returns:
  Int value.

### putInt

protected final void putInt(int field, int v)
Puts an int value in a field.

Parameters:
  `field` - Offset of the field.
  `v` - Int value.

### putInt

protected final void putInt(int field, int index, int v)
Puts an int value at the specified position of an int array.

Parameters:
  `field` - Offset of the int array.
  `index` - Index of the int in the array.
  `v` - Int value.

### getLong

protected final long getLong(int field)
Gets the long value of a field.

Parameters:
  `field` - Offset of the field.
Returns:
  Long value.

### getLong

protected final long getLong(int field, int index)
Gets the long value at the specified position of a long array.

Parameters:
  `field` - Offset of the long array.
  `index` - Index of the long in the array.
Returns:
  Long value.

### putLong

protected final void putLong(int field, long v)
Puts a long value in a field.

Parameters:
  `field` - Offset of the field.
  `v` - Long value.

### putLong

protected final void putLong(int field, int index, long v)
Puts a long value at the specified position of a long array.

Parameters:
  `field` - Offset of the long array.
  `index` - Index of the long in the array.
  `v` - Long value.

### getFloat

protected final float getFloat(int field)
Gets the float value of a field.

Parameters:
  `field` - Offset of the field.
Returns:
  Float value.

### getFloat

protected final float getFloat(int field, int index)
Gets the float value at the specified position of a float array.

Parameters:
  `field` - Offset of the float array.
  `index` - Index of the float in the array.
Returns:
  Float value.

### putFloat

protected final void putFloat(int field, float v)
Puts a float value in a field.

Parameters:
  `field` - Offset of the field.
  `v` - Float value.

### putFloat

protected final void putFloat(int field, int index, float v)
Puts a float value at the specified position of a float array.

Parameters:
  `field` - Offset of the float array.
  `index` - Index of the float in the array.
  `v` - Float value.

### getDouble

protected final double getDouble(int field)
Gets the double value of a field.

Parameters:
  `field` - Offset of the field.
Returns:
  Double value.

### getDouble

protected final double getDouble(int field, int index)
Gets the double value at the specified position of a double array.

Parameters:
  `field` - Offset of the double array.
  `index` - Index of the double in the array.
Returns:
  Double value.

### putDouble

protected final void putDouble(int field, double v)
Puts a double value in a field.

Parameters:
  `field` - Offset of the field.
  `v` - Double value.

### putDouble

protected final void putDouble(int field, int index, double v)
Puts a double value at the specified position of a double array.

Parameters:
  `field` - Offset of the double array.
  `index` - Index of the double in the array.
  `v` - Double value.

### getData

protected final <S extends Struct, D extends Struct.Data> D getData(S struct, int field)

### getData

protected final <S extends Struct, D extends Struct.Data> D getData(S struct, int field, int index)

### getBuffer

protected final ByteBuffer getBuffer(Datatype type, int field)
Gets the buffer of a field.

The buffer can be used in `send`/`recv` operations.

Parameters:
  `type` - Data type of the buffer.
  `field` - Offset of the field.
Returns:
  Buffer object.

### getBuffer

protected final ByteBuffer getBuffer(Datatype type, int field, int index) throws MPIException
Gets the buffer data at the specified position of a buffer array.

The buffer can be used in `send`/`recv` operations.

Parameters:
  `type` - Data type of the buffer.
  `field` - Offset of the buffer array.
  `index` - Index of the buffer in the array.
Returns:
  Buffer object.
Throws:
  `MPIException` - Signals that an MPI error of some sort has occurred.