Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.groovy.grails.web.util
Class StreamByteBuffer

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

    public class StreamByteBuffer

extends 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.

Author:
  Lari Hotari, Sagire Software Oy

Nested Class Summary
`static class` | `StreamByteBuffer.ReadMode`
`(package private) class` | `StreamByteBuffer.StreamByteBufferChunk`
`(package private) class` | `StreamByteBuffer.StreamByteBufferInputStream`
`(package private) class` | `StreamByteBuffer.StreamByteBufferOutputStream`

Constructor Summary
`StreamByteBuffer()`
`StreamByteBuffer(int chunkSize)`
`StreamByteBuffer(int chunkSize, StreamByteBuffer.ReadMode readMode)`

Method Summary
`protected int` | `allocateSpace()`
`InputStream` | `getInputStream()`
`OutputStream` | `getOutputStream()`
`StreamByteBuffer.ReadMode` | `getReadMode()`
`protected int` | `prepareRead()`
`byte[]` | `readAsByteArray()`
`String` | `readAsString(Charset charset)`
`String` | `readAsString(String encoding)`
`void` | `reset()`
`void` | `retainAfterReadingMode()`
`void` | `setReadMode(StreamByteBuffer.ReadMode readMode)`
`int` | `totalBytesUnread()`
`void` | `writeTo(OutputStream target)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### StreamByteBuffer

    public StreamByteBuffer()

### StreamByteBuffer

    public StreamByteBuffer(int chunkSize)

### StreamByteBuffer

    public StreamByteBuffer(int chunkSize,
                            StreamByteBuffer.ReadMode readMode)

Method Detail

### getOutputStream

    public OutputStream getOutputStream()

### getInputStream

    public InputStream getInputStream()

### writeTo

    public void writeTo(OutputStream target)
                 throws IOException

  Throws:
    `IOException`

### readAsByteArray

    public byte[] readAsByteArray()

### readAsString

    public String readAsString(String encoding)
                        throws CharacterCodingException

  Throws:
    `CharacterCodingException`

### readAsString

    public String readAsString(Charset charset)
                        throws CharacterCodingException

  Throws:
    `CharacterCodingException`

### totalBytesUnread

    public int totalBytesUnread()

### allocateSpace

    protected int allocateSpace()

### prepareRead

    protected int prepareRead()

### reset

    public void reset()

### getReadMode

    public StreamByteBuffer.ReadMode getReadMode()

### setReadMode

    public void setReadMode(StreamByteBuffer.ReadMode readMode)

### retainAfterReadingMode

    public void retainAfterReadingMode()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD