Initializes the src buffer. Should only be called by InboundHandler
implementations that have a ByteBuffer as source.

@param sizeBytes the size of the srcBuffer in bytes.
964022
protected final void initSrcBuffer(int sizeBytes) {
        ChannelOptions config = channel.options();
        src = (S) newByteBuffer(sizeBytes, config.getOption(DIRECT_BUF));
    }
173669
private void setAndAllocateBuffer(int sizeToAllocate) {
        
        if(_buffer == null){
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()){
                Tr.debug(tc, "setAndAllocateBuffer, Buffer is null, size to allocate is : " + sizeToAllocate);
            }
            _buffer = allocateBuffer(sizeToAllocate);
        }
        
        configurePreReadBuffer(sizeToAllocate);
        
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()){  
          Tr.debug(tc, "setAndAllocateBuffer, Setting the buffer : " + _buffer );         
        }
        
        _tcpContext.getReadInterface().setBuffer(_buffer);
    }
761148
private void prepareBuffers(List<DBBPool.BBContainer> buffers)
    {
        Preconditions.checkArgument(buffers.size() == m_tableTasks.size());

        UnmodifiableIterator<SnapshotTableTask> iterator = m_tableTasks.iterator();
        for (DBBPool.BBContainer container : buffers) {
            int headerSize = iterator.next().m_target.getHeaderSize();
            final ByteBuffer buf = container.b();
            buf.clear();
            buf.position(headerSize);
        }
    }
1021630
void initNewBuffer(Writer out, int bufSize)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
        { // 306998.15
            Tr.debug(tc, "initNewBuffer, size --> " + bufSize + " this --> " + this);
        }
        this.out = out;
        this.except = null;
        bufferSize = bufSize;
        buf = new char[bufferSize];
    }
1238109
public void putByte(int pos, byte b) {
		adaptSize(pos + 1);
		ByteBuffer bb = getBuffer(pos);
		int i = pos % _bufferSize;
		bb.put(i, b);
	}
145745
public static byte[] toByteArray(InputStream in, int bufferSize) throws IOException {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        copyData(in, out, bufferSize);
        return out.toByteArray();
    }
71807
static void fillBufferFrom(InputStream in, byte[] buf, int offset, int len)
            throws IOException
    {
        for (int read = 0; len > 0; len -= read, offset += read)
        {
            read = in.read(buf, offset, len);
            if (read == -1)
                throw ProtobufException.truncatedMessage();
        }
    }
761951
private void init() throws IOException {
        bsPutUByte('B');
        bsPutUByte('Z');

        this.data = new Data(this.blockSize100k);
        this.blockSorter = new BlockSort(this.data);

        // huffmanised magic bytes
        bsPutUByte('h');
        bsPutUByte('0' + this.blockSize100k);

        this.combinedCRC = 0;
        initBlock();
    }
1010270
private void initializeBufferQueue(int segmentFileSizeMB) {
        int bufferLength = 
            (segmentFileSizeMB < Segment.maxSegmentFileSizeMB) ?
            (segmentFileSizeMB * 1024 * 1024) : Integer.MAX_VALUE;
            
        lazyCount = 3;
        for (int i = 0; i < lazyCount; i++) {
            ByteBuffer buffer = ByteBuffer.wrap(new byte[bufferLength]);
            _bufferQueue.add(buffer);
        }
    }
352275
public void setBufferSize(int size)
    {
        HttpOutputStream out = (HttpOutputStream)_httpResponse.getOutputStream();
        if (out.isWritten()  || _writer!=null && _writer.isWritten())
            throw new IllegalStateException("Output written");
        out.setBufferSize(size);
    }
425627
@Override
    public void setBufferSize(int size) {
        if (this.writing || isClosed()) {
            throw new IllegalStateException("Stream unable to set size");
        }
        this.amountToBuffer = size;
        this.bbSize = (49152 < size) ? 32768 : 8192;

        // make sure we never create larger frames than the max http2 frame size
        Integer h2size = (Integer) this.getVc().getStateMap().get("h2_frame_size");
        if (h2size != null && h2size < bbSize) {
            this.bbSize = h2size;
        }

        int numBuffers = (size / this.bbSize);
        if (0 == size || 0 != (size % this.bbSize)) {
            numBuffers++;
        }
        this.output = new WsByteBuffer[numBuffers];
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "setBufferSize=" + size + "; " + this);
        }
    }
476401
public void write(final byte[] srcBytes, final int srcOffset, final int length)
    {
        final long resultingOffset = position + ((long)length);
        if (resultingOffset > this.length)
        {
            throw new IllegalStateException("insufficient capacity in the buffer");
        }

        buffer.putBytes(offset + position, srcBytes, srcOffset, length);
        position += length;
    }
218865
public void init(HttpOutboundServiceContext sc, BNFHeaders hdrs) {
        setOwner(sc);
        setBinaryParseState(HttpInternalConstants.PARSING_BINARY_VERSION);
        if (null != hdrs) {
            hdrs.duplicate(this);
        }
    }
200139
public void setBytes(long memoryOffset, byte[] buffer, int bufferOffset, int count)
    {
        if (buffer == null)
            throw new NullPointerException();
        else if (bufferOffset < 0
                 || count < 0
                 || bufferOffset + count > buffer.length)
            throw new IndexOutOfBoundsException();
        else if (count == 0)
            return;

        long end = memoryOffset + count;
        checkBounds(memoryOffset, end);

        unsafe.copyMemory(buffer, BYTE_ARRAY_BASE_OFFSET + bufferOffset, null, peer + memoryOffset, count);
    }
1127994
private void ABITraceInit(BufferedInputStream bis) throws IOException{
		byte[] bytes = null;
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		int b;
		while ((b = bis.read()) >= 0)
		{
			baos.write(b);
		}
		bis.close(); baos.close();
		bytes = baos.toByteArray();
		initData(bytes);
	}
278314
private void buffer(byte b) {
        if (buffer.hasCapacity()) {
            buffer.put(b);
        } else {
            throw VFSMessages.MESSAGES.bufferDoesntHaveEnoughCapacity();
        }
    }
498832
public static ByteBuf wrappedBuffer(long memoryAddress, int size, boolean doFree) {
        return new WrappedUnpooledUnsafeDirectByteBuf(ALLOC, memoryAddress, size, doFree);
    }