org.codehaus.groovy.grails.web.util
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.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
StreamByteBuffer
public StreamByteBuffer()
StreamByteBuffer
public StreamByteBuffer(int chunkSize)
StreamByteBuffer
public StreamByteBuffer(int chunkSize,
StreamByteBuffer.ReadMode readMode)
getOutputStream
public java.io.OutputStream getOutputStream()
getInputStream
public java.io.InputStream getInputStream()
writeTo
public void writeTo(java.io.OutputStream target)
throws java.io.IOException
- Throws:
java.io.IOException
readAsByteArray
public byte[] readAsByteArray()
readAsString
public java.lang.String readAsString(java.lang.String encoding)
throws java.nio.charset.CharacterCodingException
- Throws:
java.nio.charset.CharacterCodingException
readAsString
public java.lang.String readAsString(java.nio.charset.Charset charset)
throws java.nio.charset.CharacterCodingException
- Throws:
java.nio.charset.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()