Class ByteArrayRequest
java.lang.Object
com.mouseviator.fsuipc.datarequest.DataRequest
com.mouseviator.fsuipc.datarequest.primitives.ByteArrayRequest
- All Implemented Interfaces:
IDataRequest<byte[]>
public class ByteArrayRequest extends DataRequest implements IDataRequest<byte[]>
This class implements byte array data request for use with
FSUIPC
class. It is for good use when reading/writing bigger chunks of data
which we cannot wrap into primitive data types.- Author:
- Mouseviator
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.mouseviator.fsuipc.datarequest.IDataRequest
IDataRequest.RequestType
-
Field Summary
Fields inherited from class com.mouseviator.fsuipc.datarequest.DataRequest
BUFFER_LENGTH_BYTE, BUFFER_LENGTH_DOUBLE, BUFFER_LENGTH_FLOAT, BUFFER_LENGTH_INT, BUFFER_LENGTH_LONG, BUFFER_LENGTH_SHORT, dataBuffer, MAX_OFFSET_VALUE, MIN_OFFSET_VALUE, offset, type
-
Constructor Summary
Constructors Constructor Description ByteArrayRequest(int size)
Creates a new byte array data request of specified size.ByteArrayRequest(int offset, byte[] data)
Creates a new byte array data request associated with given offset and initialized with data from given byte array.ByteArrayRequest(int offset, int size)
Creates a new byte array data request of specified size associated with given offset. -
Method Summary
Methods inherited from class com.mouseviator.fsuipc.datarequest.DataRequest
convertStringToByteArray, copyByteArray, getDataBuffer, getDouble, getFloat, getInt, getLong, getOffset, getShort, getSize, getType, getZeroTerminatedString, putDouble, putDouble, putFloat, putFloat, putInt, putInt, putLong, putLong, putShort, putShort, setOffset, setType
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.mouseviator.fsuipc.datarequest.IDataRequest
getDataBuffer, getOffset, getSize, getType, setOffset, setType
-
Constructor Details
-
ByteArrayRequest
public ByteArrayRequest(int size)Creates a new byte array data request of specified size.- Parameters:
size
- The number of bytes to allocate for this data request.
-
ByteArrayRequest
public ByteArrayRequest(int offset, int size) throws java.security.InvalidParameterExceptionCreates a new byte array data request of specified size associated with given offset.- Parameters:
offset
- An offset to associate this data request with.size
- The number of bytes to allocate for this data request.- Throws:
java.security.InvalidParameterException
-
ByteArrayRequest
public ByteArrayRequest(int offset, byte[] data) throws java.security.InvalidParameterExceptionCreates a new byte array data request associated with given offset and initialized with data from given byte array. This also sets the data request type to WRITE.- Parameters:
offset
- An offset to associate this data request with.data
- An actual data. Note that the array will not be copied, will be used directly.- Throws:
java.security.InvalidParameterException
-
-
Method Details
-
getValue
public byte[] getValue()Description copied from interface:IDataRequest
Returns the value stored within this data request byte data buffer.- Specified by:
getValue
in interfaceIDataRequest<byte[]>
- Returns:
- The value stored within this data request.
-
setValue
public void setValue(byte[] value)Description copied from interface:IDataRequest
Sets the value to be stored in the byte data buffer of this data request.- Specified by:
setValue
in interfaceIDataRequest<byte[]>
- Parameters:
value
- The value to store.
-