Groovy Documentation

org.codehaus.groovy.grails.web.util
[Java] Class StreamByteBuffer

java.lang.Object
  org.codehaus.groovy.grails.web.util.StreamByteBuffer

public class StreamByteBuffer
extends java.lang.Object

An in-memory buffer that provides OutputStream and InputStream interfaces. This is more efficient than using ByteArrayOutputStream/ByteArrayInputStream This is not thread-safe, it is intended to be used by a single Thread.

Authors:
Lari Hotari, Sagire Software Oy


Nested Class Summary
enum StreamByteBuffer.ReadMode

 
Constructor Summary
StreamByteBuffer()

An in-memory buffer that provides OutputStream and InputStream interfaces.

StreamByteBuffer(int chunkSize)

StreamByteBuffer(int chunkSize, StreamByteBuffer.ReadMode readMode)

 
Method Summary
protected int allocateSpace()

java.io.InputStream getInputStream()

java.io.OutputStream getOutputStream()

StreamByteBuffer.ReadMode getReadMode()

protected int prepareRead()

byte[] readAsByteArray()

java.lang.String readAsString(java.lang.String encoding)

java.lang.String readAsString(java.nio.charset.Charset charset)

void reset()

void retainAfterReadingMode()

void setReadMode(StreamByteBuffer.ReadMode readMode)

int totalBytesUnread()

void writeTo(java.io.OutputStream target)

 
Methods inherited from class java.lang.Object
java.lang.Object#wait(), java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Constructor Detail

StreamByteBuffer

public StreamByteBuffer()
An in-memory buffer that provides OutputStream and InputStream interfaces. This is more efficient than using ByteArrayOutputStream/ByteArrayInputStream This is not thread-safe, it is intended to be used by a single Thread.
Authors:
Lari Hotari, Sagire Software Oy


StreamByteBuffer

public StreamByteBuffer(int chunkSize)


StreamByteBuffer

public StreamByteBuffer(int chunkSize, StreamByteBuffer.ReadMode readMode)


 
Method Detail

allocateSpace

protected int allocateSpace()


getInputStream

public java.io.InputStream getInputStream()


getOutputStream

public java.io.OutputStream getOutputStream()


getReadMode

public StreamByteBuffer.ReadMode getReadMode()


prepareRead

protected int prepareRead()


readAsByteArray

public byte[] readAsByteArray()


readAsString

public java.lang.String readAsString(java.lang.String encoding)


readAsString

public java.lang.String readAsString(java.nio.charset.Charset charset)


reset

public void reset()


retainAfterReadingMode

public void retainAfterReadingMode()


setReadMode

public void setReadMode(StreamByteBuffer.ReadMode readMode)


totalBytesUnread

public int totalBytesUnread()


writeTo

public void writeTo(java.io.OutputStream target)


 

Groovy Documentation