sleep.bridges.io

Class BufferObject


public class BufferObject
extends IOObject

The buffer works as follows. Once allocated it is open for writing. When the scripter chooses to close the buffer it is then available for reading. The second time it is closed all of its resources are deallocated.

Field Summary

protected ByteArrayInputStream
readme
The readable source for this IO object
protected ByteArrayOutputStream
source
The writeable source for this IO object

Fields inherited from class sleep.bridges.io.IOObject

buffer, in, out, reader, readerb, readeru, thread, token, writerb, writeru

Method Summary

void
allocate(int initialSize)
allocates a writeable buffer with the specified initial capacity
void
close()
handles our closing semantices i.e.
Object
getSource()
returns the stream referenced by this IOObject

Methods inherited from class sleep.bridges.io.IOObject

close, getBuffer, getConsole, getInputBuffer, getInputStream, getOutputStream, getReader, getSource, getThread, getToken, getWriter, isEOF, openRead, openWrite, print, printLine, readCharacter, readLine, sendEOF, setEncoding, setThread, setToken, wait

Field Details

readme

protected ByteArrayInputStream readme
The readable source for this IO object

source

protected ByteArrayOutputStream source
The writeable source for this IO object

Method Details

allocate

public void allocate(int initialSize)
allocates a writeable buffer with the specified initial capacity

close

public void close()
handles our closing semantices i.e. first time it is called the writeable portion is opened up for reading and the second time all resources are deallocated
Overrides:
close in interface IOObject

getSource

public Object getSource()
returns the stream referenced by this IOObject
Overrides:
getSource in interface IOObject