FileDocCategorySizeDatePackage
ByteBufferOutputStream.javaAPI DocExample3399Tue May 29 16:57:08 BST 2007com.sun.xml.ws.transport.tcp.io

ByteBufferOutputStream

public class ByteBufferOutputStream extends OutputStream
author
Alexey Stashok

Fields Summary
private static final boolean
USE_DIRECT_BUFFER
private ByteBuffer
outputBuffer
Constructors Summary
public ByteBufferOutputStream()

    
      
        outputBuffer = ByteBufferFactory.allocateView(USE_DIRECT_BUFFER);
    
public ByteBufferOutputStream(int initSize)

        outputBuffer = ByteBufferFactory.allocateView(initSize, USE_DIRECT_BUFFER);
    
public ByteBufferOutputStream(ByteBuffer outputBuffer)

        this.outputBuffer = outputBuffer;
    
Methods Summary
public voidclose()

    
public java.nio.ByteBuffergetByteBuffer()

        outputBuffer.flip();
        return outputBuffer;
    
public voidreset()

        outputBuffer.clear();
    
public voidwrite(int data)

        if (outputBuffer.position() == outputBuffer.capacity() - 1) {
            final ByteBuffer tmpBuffer = ByteBufferFactory.allocateView(outputBuffer.capacity() * 2, USE_DIRECT_BUFFER);
            tmpBuffer.put(outputBuffer);
            outputBuffer = tmpBuffer;
        }
        
        outputBuffer.put((byte) data);