Wraps our Buffer into another to fit the Minecraft protocol.
177697
function writePCBuffer(client, buffer) {
    var length = pcbuffer.createBuffer();


    length.writeVarInt(buffer.buffer().length);

    client.write(Buffer.concat([length.buffer(), buffer.buffer()]));
}
701372
function joinBuffers(buffers) {
		var
			i = -1, j = -1,
			num = buffers.length,
			totalBytes = 0,
			bytesWritten = 0,
			buff,
			superBuff
		;
		while (++i < num) {
			totalBytes += buffers[i].length;
		}
		superBuff = new Buffer(totalBytes);
		while (++j < num) {
			buff = buffers[j];
			buff.copy(superBuff, bytesWritten, 0);
			bytesWritten += buff.length;
		}
		return superBuff;
	}
689494
private ByteBuffer ensureBuffer(int size, ByteBuffer buffer, WritableByteChannel output) throws IOException {
    if(buffer.remaining() >= size) {
      return buffer;
    }
    flushBuffer(buffer, output);
    if(buffer.remaining() >= size) {
      return buffer;
    }
    // Aggressively grow the buffer
    return ByteBuffer.allocateDirect(Math.max(buffer.capacity() << 1, buffer.capacity() + size));
  }
972343
function PrependLength(buffer, len) {
  let lenBuf = new Buffer(4);
  lenBuf.writeUInt32LE(len, 0);
  return Buffer.concat([lenBuf, buffer], buffer.length + 4);
}
786521
def block_transfer(self, buffer, x, y):
        
        self._buffer.block_transfer(buffer, x, y)
394985
def wrap(self, data, many):
        """"""
        if not many:
            return data
        else:
            data = {'contents': data}
            bucket = self.context.get('bucket')
            if bucket:
                data.update(BucketSchema().dump(bucket).data)
            return data
196793
private static int put(byte[] block, int offset, ByteBuffer buf) {
    int len = Math.min(block.length - offset, buf.remaining());
    buf.get(block, offset, len);
    return len;
  }
158269
def buffer(self, byte_offset=0):
        """"""
        contents = self.ptr.contents
        ptr = addressof(contents.buffer.contents) + byte_offset
        length = contents.length * 4 - byte_offset
        return buffer((c_char * length).from_address(ptr).raw) \
            if length else None
1325535
def merge(self, buffer, other_hyper_log_log):
        

        for i in range(len(buffer)):
            buffer[i] = max(buffer[i], other_hyper_log_log[i])
278482
def into_buffer(self, buf, offset):
    
    self.payload = containerize(exclude_fields(self))
    self.parser = MsgEphemerisGPSDepF._parser
    self.stream_payload.reset(buf, offset)
    return self.pack_into(buf, offset, self._build_payload)
679074
def wrap(self, sock):
        """"""
        try:
            s = ssl.wrap_socket(sock, do_handshake_on_connect=True,
                    server_side=True, certfile=self.certificate,
                    keyfile=self.private_key, ssl_version=ssl.PROTOCOL_SSLv23)
        except ssl.SSLError, e:
            if e.errno == ssl.SSL_ERROR_EOF:
                # This is almost certainly due to the cherrypy engine
                # 'pinging' the socket to assert it's connectable;
                # the 'ping' isn't SSL.
                return None, {}
            elif e.errno == ssl.SSL_ERROR_SSL:
                if e.args[1].endswith('http request'):
                    # The client is speaking HTTP to an HTTPS server.
                    raise wsgiserver.NoSSLError
            raise
        return s, self.get_environ(s)
529264
public static void append(ByteBuffer to, byte b) {
        int pos = flipToFill(to);
        try {
            to.put(b);
        } finally {
            flipToFlush(to, pos);
        }
    }
972969
public static void append(ByteBuffer to, byte[] b, int off, int len) throws BufferOverflowException {
        int pos = flipToFill(to);
        try {
            to.put(b, off, len);
        } finally {
            flipToFlush(to, pos);
        }
    }
586583
public WrappedByteBuffer putBufferAt(int index, WrappedByteBuffer v) {
        // TODO: I believe this method incorrectly moves the position!
        // Can't change it without a code analysis - and this is a public API!
        int pos = _buf.position();
        _buf.position(index);
        _buf.put(v._buf);
        _buf.position(pos);
        return this;
    }
529090
def wrap(self, gammaramp):
        '''
        
        '''
        red, green, blue = gammaramp
        size = min(len(red), len(green), len(blue))
        array_type = ctypes.c_ushort*size
        self.size = ctypes.c_uint(size)
        self.red_array = array_type()
        self.green_array = array_type()
        self.blue_array = array_type()
        for i in range(self.size):
            self.red_array[i] = int(red[i]*65535)
            self.green_array[i] = int(green[i]*65535)
            self.blue_array[i] = int(blue[i]*65535)
        pointer_type = ctypes.POINTER(ctypes.c_ushort)
        self.red = ctypes.cast(self.red_array, pointer_type)
        self.green = ctypes.cast(self.green_array, pointer_type)
        self.blue = ctypes.cast(self.blue_array, pointer_type)
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();
        }
    }
947765
public WrappedByteBuffer fillWith(byte b, int size) {
        _autoExpand(size);
        while (size-- > 0) {
            _buf.put(b);
        }
        return this;
    }