Get a buffer to write to this InputStream.
The buffer wll either be a new direct buffer or a recycled buffer.
337160
public synchronized ByteBuffer getBuffer()
    {
        ByteBuffer buf=null;
        int s=LazyList.size(_recycle);
        if (s>0)
        {
            s--;
             buf=(ByteBuffer)LazyList.get(_recycle, s);
             _recycle=LazyList.remove(_recycle,s);
             buf.clear();
        }
        else
        {
            buf=ByteBuffer.allocateDirect(_bufferSize);
        }
         return buf;     
    }
885796
public static ByteBuf copiedBuffer(ByteBuffer buffer) {
        int length = buffer.remaining();
        if (length == 0) {
            return EMPTY_BUFFER;
        }
        byte[] copy = PlatformDependent.allocateUninitializedArray(length);
        // Duplicate the buffer so we not adjust the position during our get operation.
        // See https://github.com/netty/netty/issues/3896
        ByteBuffer duplicate = buffer.duplicate();
        duplicate.get(copy);
        return wrappedBuffer(copy).order(duplicate.order());
    }
1001065
@Override
    public OutputStream getOutputStream() throws IOException {
	if (!_file.isWriteable()) {
	    throw new IOException("Cannot write");
	}
	return IOUtil.toBufferedOutputStream(_file.getOutputStream());
    }
256260
private BufferPool.Buffer getBuffer(final int pos,
                           final boolean forRead) {
    if ((curBuffer != null) && curBuffer.contains(pos)){
      return curBuffer;
    }

    for (BufferPool.Buffer b: buffers) {
      if (forRead) {
        if (b.contains(pos)) {
          curBuffer = b;
          return b;
        }

        continue;
      }

      if ((b.at(pos))) {
        curBuffer = b;
        return b;
      }
    }

    return null;
  }
192536
public WriteStreamOld openWrite()
  {
    if (_cb != null)
      _cb.clear();
    else
      _cb = CharBuffer.allocate();

    if (_ws == null)
      _ws = new WriteStreamOld(this);
    else
      _ws.init(this);

    try {
      _ws.setEncoding("utf-8");
    } catch (UnsupportedEncodingException e) {
    }

    return _ws;
  }
416848
public static Persistable persistable(final ByteBuffer buffer) {
        return new Persistable() {

            @Override
            public int size() {
                return buffer.limit();
            }

            @Override
            public void write(ByteBuffer buffer1) {
                buffer1.put(buffer);
                buffer1.flip();
            }

            @Override
            public void read(ByteBuffer buffer1) {
                buffer.rewind();
                buffer.put(buffer1);
                buffer.rewind();
            }

        };
    }
918222
public int write( final ByteBuffer buffer) throws IOException {
		for ( Consumer< ?> consumer : consumers.values()) consumer.consume( buffer.duplicate());
		return channel.write( buffer);
	}

	/**
	 * Closes the underlying channel and completes
	 * any outstanding operations in the consumers.
	 *
	 * @throws IOException if an IO error occurs
	 */
	public void close() throws IOException {
		channel.close();
		super.close();
	}

	/**
	 * Flag indicating whether the underlying channel
	 * is open.
	 *
	 * @return true if it is open, false otherwise
	 */
	public boolean isOpen() {
		return channel.isOpen();
	}
}
38659
private java.nio.ByteBuffer getWritingRow() {
        final int row = this.writerIndex / this.localCapacity;
        if (row >= this.storage.size()) {
            final java.nio.ByteBuffer buf = java.nio.ByteBuffer.allocate(this.localCapacity);
            this.storage.add(buf);
            return buf;
        }

        return this.storage.get(row);
    }
1042722
private MessageBuffer getNextBuffer()
            throws IOException
    {
        MessageBuffer next = in.next();
        if (next == null) {
            throw new MessageInsufficientBufferException();
        }
        assert (buffer != null);
        totalReadBytes += buffer.size();
        return next;
    }
242447
def get_buffer(self, format, output=None):
        
        return self.io.get_buffer(self._get_data(), self.get_header(),
                                  format, output=output)
386998
private WsByteBuffer makeBuffer(int len) {
        WsByteBuffer buffer = HttpDispatcher.getBufferManager().allocateDirect(len);
        buffer.put(this.buf, 0, len);
        buffer.flip();
        return buffer;
    }
939586
function () {
    var i
    this.write = this.sendWrite
    for (i = 0; i < this._buffer.length; i++) this.write(this._buffer[i])
    this._buffer.length = 0
    return this
  }
1043880
public ByteBuffer getByteBuffer() throws IOException
    {
        return rwChannel.map( FileChannel.MapMode.READ_ONLY, 0, file.length() );
    }
499611
public ByteBuffer makeByteBuffer(InputStream in)
        throws IOException {
        int limit = in.available();
        if (limit < 1024) limit = 1024;
        ByteBuffer result = byteBufferCache.get(limit);
        int position = 0;
        while (in.available() != 0) {
            if (position >= limit)
                // expand buffer
                result = ByteBuffer.
                    allocate(limit <<= 1).
                    put((ByteBuffer)result.flip());
            int count = in.read(result.array(),
                position,
                limit - position);
            if (count < 0) break;
            result.position(position += count);
        }
        return (ByteBuffer)result.flip();
    }
340701
@Override
  public synchronized void write(final int b) {
    BufferPool.Buffer buff = getBuffer(count, false);

    if (buff == null) {
      buff = newBuffer();
    }

    if (!buff.putByte(b)) {
      buff = newBuffer();
      if (!buff.putByte(b)) {
        throw new RuntimeException("Logic error in write(b)");
      }
    }

    count++;
  }
863303
public static Buffer toBuffer(AbstractEvent event) throws IOException {
		final ByteBuffer serializedEvent = EventSerializer.toSerializedEvent(event);

		MemorySegment data = MemorySegmentFactory.wrap(serializedEvent.array());

		final Buffer buffer = new NetworkBuffer(data, FreeingBufferRecycler.INSTANCE, false);
		buffer.setSize(serializedEvent.remaining());

		return buffer;
	}
399802
public ByteBuffer toThrift() {
    Buffer buffer = Buffer.allocate(sizeInBytes());
    write(buffer);
    return ByteBuffer.wrap(buffer.toByteArray());
  }