org.ogf.saga.buffer
Interface Buffer

All Superinterfaces:
Cloneable, SagaObject
All Known Subinterfaces:
IOVec

public interface Buffer
extends SagaObject

Encapsulates a sequence of bytes to be used for I/O operations.


Field Summary
 
Fields inherited from interface org.ogf.saga.SagaObject
NO_WAIT, WAIT_FOREVER
 
Method Summary
 void close()
          Non-blocking close of the buffer object.
 void close(float timeoutInSeconds)
          Closes the buffer object.
 byte[] getData()
          Retrieves the buffer data.
 int getSize()
          Retrieves the current value of the buffer size.
 void setData(byte[] data)
          Sets the buffer data.
 void setSize()
          Sets the size of the buffer.
 void setSize(int size)
          Sets the size of the buffer.
 
Methods inherited from interface org.ogf.saga.SagaObject
clone, getId, getSession
 

Method Detail

setSize

void setSize(int size)
             throws BadParameterException,
                    IncorrectStateException,
                    NoSuccessException
Sets the size of the buffer. This method is semantically equivalent to re-creating it with the specified size. This makes the buffer implementation-allocated, unless size = -1, in which case it becomes implementation-managed. Spec inconsistency: this method should also throw NoSuccess, as the constructor can throw this, and this method is semantically equivalent to destruct and then call constructor.

Parameters:
size - the size.
Throws:
IncorrectStateException - is thrown when the buffer is closed.
BadParameterException - is thrown when the implementation cannot handle the specified size.
NoSuccessException - is thrown when the operation was not successfully performed, and none of the other exceptions apply.

setSize

void setSize()
             throws BadParameterException,
                    IncorrectStateException,
                    NoSuccessException
Sets the size of the buffer. This method is semantically equivalent to re-creating it. This method makes the buffer implementation-managed. Spec inconsistency: this method should also throw NoSuccess, as the constructor can throw this, and this method is semantically equivalent to destruct and then call constructor.

Throws:
IncorrectStateException - is thrown when the buffer is closed.
BadParameterException - is thrown when the implementation cannot handle the default size.
NoSuccessException - is thrown when the operation was not successfully performed, and none of the other exceptions apply.

getSize

int getSize()
            throws IncorrectStateException
Retrieves the current value of the buffer size.

Returns:
the size.
Throws:
IncorrectStateException - is thrown when the buffer is closed.

setData

void setData(byte[] data)
             throws BadParameterException,
                    IncorrectStateException,
                    NoSuccessException
Sets the buffer data. Makes the buffer application-managed. Deviation from the SAGA specs: the size is implicit in the byte array. Calling this method implies: user-allocated data. Spec inconsistency: this method should also throw NoSuccess, as the constructor can throw this, and this method is semantically equivalent to destruct and then call constructor.

Parameters:
data - the data.
Throws:
IncorrectStateException - is thrown when the buffer is closed.
BadParameterException - is thrown when the implementation cannot handle the specified data buffer.
NoSuccessException - is thrown when the operation was not successfully performed, and none of the other exceptions apply.

getData

byte[] getData()
               throws DoesNotExistException,
                      IncorrectStateException
Retrieves the buffer data.

Returns:
the data.
Throws:
IncorrectStateException - is thrown when the buffer is closed.
DoesNotExistException - is thrown when the buffer was created with size -1, and no I/O operation has been done on it yet.

close

void close()
Non-blocking close of the buffer object.


close

void close(float timeoutInSeconds)
Closes the buffer object.

Parameters:
timeoutInSeconds - he timeout in seconds.


Copyright © 2014 Open Grid Forum. All rights reserved.