Reads the state of the skeletal bone data associated with this action and copies it into the given buffer.
345583
def getSkeletalBoneData(self, action, eTransformSpace, eMotionRange, unTransformArrayCount):
        """"""

        fn = self.function_table.getSkeletalBoneData
        pTransformArray = VRBoneTransform_t()
        result = fn(action, eTransformSpace, eMotionRange, byref(pTransformArray), unTransformArrayCount)
        return result, pTransformArray
445244
public void copyToDirectBuffer() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "copyToDirectBuffer");
        }

        if (oByteBuffer.isDirect()) {
            this.oWsBBDirect = this.oByteBuffer;
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
                Tr.exit(tc, "copyToDirectBuffer, exit point 1");
            }
            return;
        }

        if (this.quickBufferAction == ACTIVATED) {

            synchronized (wsBBRoot.actionAccess) {
                if (wsBBRoot.actionState == PooledWsByteBufferImpl.COPY_WHEN_NEEDED_STATE1) {

                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "bufferAction in STATE1, do not copy");
                    }

                    // no put activity has been done on the NonDirect Buffer, so
                    // the data in the Direct buffer can be written as is
                    this.oWsBBDirect.limit(oByteBuffer.limit());
                    this.oWsBBDirect.position(oByteBuffer.position());

                    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
                        Tr.exit(tc, "copyToDirectBuffer, exit point 2");
                    }
                    return;
                }

                if (wsBBRoot.actionState == PooledWsByteBufferImpl.COPY_WHEN_NEEDED_STATE2) {

                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "bufferAction in STATE2, copy only changed data");
                    }

                    // put activity has been done on the NonDirect Buffer, so
                    // the new data in the nonDirect buffer needs to be copied
                    // down to the Direct Buffer
                    if ((wsBBRoot.putMin != -1) && (wsBBRoot.putMax != -1)) {

                        copyRangeToDirectBuffer(wsBBRoot.putMin, wsBBRoot.putMax);
                        wsBBRoot.putMin = -1;
                        wsBBRoot.putMax = -1;
                    }

                    this.oWsBBDirect.limit(oByteBuffer.limit());
                    this.oWsBBDirect.position(oByteBuffer.position());

                    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
                        Tr.exit(tc, "copyToDirectBuffer, exit point 3");
                    }
                    return;
                }
            } // end-sync
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "buffer optimization is off, copy all data");
        }

        // we are here because either Optimization was never on, or it just switched off.
        if (oWsBBDirect == null) {
            this.oWsBBDirect = ByteBuffer.allocateDirect(oByteBuffer.capacity());
        }

        int cachePosition = this.oByteBuffer.position();
        int cacheLimit = this.oByteBuffer.limit();
        int offset = this.oByteBuffer.arrayOffset();

        // set the position and limit for copying
        this.oWsBBDirect.limit(cacheLimit);
        this.oWsBBDirect.position(cachePosition);

        // copy the bytes from position to limit
        this.oWsBBDirect.put(oByteBuffer.array(), cachePosition + offset, cacheLimit - cachePosition);

        // reset the position
        this.oWsBBDirect.position(cachePosition);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "copyToDirectBuffer, exit point 4");
        }
    }
1094112
def read(self, handle):
        '''
        '''
        self.bytes_per_element, = struct.unpack('b', handle.read(1))
        dims, = struct.unpack('B', handle.read(1))
        self.dimensions = [struct.unpack('B', handle.read(1))[0] for _ in range(dims)]
        self.bytes = b''
        if self.total_bytes:
            self.bytes = handle.read(self.total_bytes)
        size, = struct.unpack('B', handle.read(1))
        self.desc = size and handle.read(size).decode('utf-8') or ''
358749
@Override
  public int read(byte []buf, int offset, int length) throws IOException
  {
    TempBuffer cursor = _cursor;
    
    if (cursor == null)
      return -1;

    int sublen = Math.min(length, cursor.length() - _offset);

    System.arraycopy(cursor.buffer(), _offset, buf, offset, sublen);

    if (cursor.length() <= _offset + sublen) {
      _cursor = cursor.next();

      if (_freeWhenDone) {
        cursor.next(null);
        TempBuffer.free(cursor);
        cursor = null;
      }
      _offset = 0;
    }
    else
      _offset += sublen;

    return sublen;
  }
380029
def _read_bytes_to_framed_body(self, b):
        
        _LOGGER.debug("collecting %d bytes", b)
        _b = b

        if b > 0:
            _frames_to_read = math.ceil(b / float(self.config.frame_length))
            b = int(_frames_to_read * self.config.frame_length)
        _LOGGER.debug("%d bytes requested; reading %d bytes after normalizing to frame length", _b, b)

        plaintext = self.source_stream.read(b)
        plaintext_length = len(plaintext)
        _LOGGER.debug("%d bytes read from source", plaintext_length)

        finalize = False

        if b < 0 or plaintext_length < b:
            _LOGGER.debug("Final plaintext read from source")
            finalize = True

        output = b""
        final_frame_written = False

        while (
            # If not finalizing on this pass, exit when plaintext is exhausted
            (not finalize and plaintext)
            # If finalizing on this pass, wait until final frame is written
            or (finalize and not final_frame_written)
        ):
            current_plaintext_length = len(plaintext)
            is_final_frame = finalize and current_plaintext_length < self.config.frame_length
            bytes_in_frame = min(current_plaintext_length, self.config.frame_length)
            _LOGGER.debug(
                "Writing %d bytes into%s frame %d",
                bytes_in_frame,
                " final" if is_final_frame else "",
                self.sequence_number,
            )
            self._bytes_encrypted += bytes_in_frame
            ciphertext, plaintext = serialize_frame(
                algorithm=self._encryption_materials.algorithm,
                plaintext=plaintext,
                message_id=self._header.message_id,
                data_encryption_key=self._derived_data_key,
                frame_length=self.config.frame_length,
                sequence_number=self.sequence_number,
                is_final_frame=is_final_frame,
                signer=self.signer,
            )
            final_frame_written = is_final_frame
            output += ciphertext
            self.sequence_number += 1

        if finalize:
            _LOGGER.debug("Writing footer")
            if self.signer is not None:
                output += serialize_footer(self.signer)
            self.__message_complete = True
        return output
973780
def read_body(response, max_bytes=None):
    """"""
    finished = Deferred()
    response.deliverBody(TruncatingReadBodyProtocol(
        response.code, response.phrase, finished, max_bytes))
    return finished
435405
async def _buffer_body(self, reader):
        
        remaining = int(self.headers.get('Content-Length', 0))
        if remaining > 0:
            try:
                self.data = await reader.readexactly(remaining)
            except asyncio.IncompleteReadError:
                raise EOFError()
154743
@Override
    public byte[] read(ScanBuffer buffer) {
        int length = getLength(buffer);
        if (length<0) return null;
        return buffer.getBytes(length);
    }
1044089
private boolean readMessage(ByteBuffer buffer) {

    // logger.finest("readMessage: " + bytesRead + " bytes read, remaining=" +
    // remainingBytes.length + ", state=" + state.toString() + ", recurse=" +
    // recurse);

    buffer.position(0);
    int bytesWeHaveBeenReading = 0;

    switch (state) {
      case SERVICELIST:
        StringBuilder builder = new StringBuilder();
        builder.append(buffer.asCharBuffer());
        parseServiceList(builder.toString());
        buffer.position(0);// reset position!
        bytesWeHaveBeenReading = buffer.limit(); // bytesWeHaveBeenreading = all
        // bytes in buffer!
        break;

      case HANDSHAKE:
        if (buffer.limit() >= 6) {
          byte[] dst = new byte[6];
          buffer.position(0);// read from start!
          buffer.get(dst);
          buffer.position(0);// reset position!
          bytesWeHaveBeenReading = 6; // 6 bytes will be removed from buffer
          String handShake = new String(dst);
          if (!handShake.equals("STP/1\n")) {
            close();
            connectionHandler.onException(
                new CommunicationException("Expected STP/1, got: " + handShake));
          }
          setState(State.EMPTY);
          connectionHandler.onHandshake(true);
        }
        break;

      case EMPTY: // read 4 byte header: STP/0
        if (buffer.limit() >= 4) {
          byte[] headerPrefix = new byte[4];
          buffer.get(headerPrefix);
          buffer.position(0);
          bytesWeHaveBeenReading = 4;
          ByteString incomingPrefix = ByteString.copyFrom(headerPrefix);
          if (stpPrefix.equals(incomingPrefix)) {
            setState(State.STP);
            /*
            if(buffer.hasRemaining()){
                buffer.compact();
                readMessage(buffer, buffer.position(), true);
            } else {
                buffer.clear();
            }
            */
          } else {
            close();
            connectionHandler.onException(
                new CommunicationException("Expected empty header"));
          }
        }
        break;

      case STP:
        // Try to read size
        buffer.position(0);
        if (buffer.limit() <= 0) {
          logger.finest("STP: Empty buffer");
          break;
        }
        int messageSize = readRawVarint32(buffer);// read part of buffer
        bytesWeHaveBeenReading = buffer.position();
        buffer.position(0);

        // If we got size, read more, if not just leave it!
        if (buffer.limit() >= bytesWeHaveBeenReading + messageSize) {
          buffer.position(bytesWeHaveBeenReading);

          // Read type and Payload!
          int messageType = buffer.get();
          bytesWeHaveBeenReading += 1;

          byte[] payload = new byte[--messageSize];
          buffer.get(payload);
          buffer.position(0);

          bytesWeHaveBeenReading += messageSize; // 32 bits = 4 bytes :-)

          setState(State.EMPTY);

          try {
            processMessage(messageType, payload);
          } catch (IOException e) {
            close();
            connectionHandler.onException(new CommunicationException(
                "Error while processing the message: " + e.getMessage()));
          }
        } else {
          // 4 + messageSize because of the int at the beginning
          logger.finest(String.format("Tried to read a message and expected %d bytes, but got %d",
                                      (4 + messageSize), buffer.limit()));

          buffer.position(0);
          bytesWeHaveBeenReading = 0;
        }
        break;

    }

    // Pop number of read bytes from
    if (bytesWeHaveBeenReading > 0) {

      // Pop X bytes, and keep message for the rest
      int rest = buffer.limit() - bytesWeHaveBeenReading;
      if (rest <= 0) {
        buffer.clear();
        buffer.limit(0);
      } else {
        byte[] temp = new byte[rest];

        buffer.position(bytesWeHaveBeenReading);
        buffer.get(temp, 0, rest);

        buffer.clear();
        buffer.limit(rest);
        buffer.position(0);
        buffer.put(temp, 0, rest);
        buffer.position(0);// set position back to start!
      }

      logger.finest(String.format("Did read message of %d bytes, new buffer size is %d",
                                  bytesWeHaveBeenReading, buffer.limit()));

      return true; // We did read a message :-)
    } else {
      if (buffer.limit() > 0) {
        logger.finest("Did NOT read message from buffer of size " + buffer.limit());
      } else {
        logger.finest("No messages in empty buffer");
      }
      return false;
    }
  }
673738
public void read(byte[] buffer) throws IOException {
        IO.read(src, buffer);
        ofs += buffer.length;
    }
1167649
ByteBuffer readView(int position)
    {
        ByteBuffer bb = content.duplicate().asReadOnlyBuffer();
        bb.position(position);
        return bb;
    }
1023429
private function readFrame()
    {
        $buf = $this->transport_->readAll(4);
        $val = unpack('N', $buf);
        $sz = $val[1];

        $this->rBuf_ = $this->transport_->readAll($sz);
    }
595962
def decompressSkeletalBoneData(self, pvCompressedBuffer, unCompressedBufferSize, eTransformSpace, unTransformArrayCount):
        """"""

        fn = self.function_table.decompressSkeletalBoneData
        pTransformArray = VRBoneTransform_t()
        result = fn(pvCompressedBuffer, unCompressedBufferSize, eTransformSpace, byref(pTransformArray), unTransformArrayCount)
        return result, pTransformArray
245794
public void copyFromDirectBuffer(int bytesRead) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "copyFromDirectBuffer: " + bytesRead);
        }

        int newPosition = this.oWsBBDirect.position();
        int cachePosition = this.oByteBuffer.position();

        if (this.quickBufferAction == NOT_ACTIVATED) {

            // copy the bytes read from the old position
            this.oWsBBDirect.position(cachePosition);

            if (bytesRead == -1) {
                // copy all the bytes up to the limit
                this.oWsBBDirect.get(oByteBuffer.array(), cachePosition + oByteBuffer.arrayOffset(), oByteBuffer.remaining());
            } else if (bytesRead > 0) {
                // copy just the bytes that were read
                this.oWsBBDirect.get(oByteBuffer.array(), cachePosition + oByteBuffer.arrayOffset(), bytesRead);
            }

            // set to the position
            this.oByteBuffer.position(newPosition);

        } else {
            synchronized (wsBBRoot.actionAccess) {
                if (wsBBRoot.actionState == PooledWsByteBufferImpl.COPY_WHEN_NEEDED_STATE1) {

                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "actionState: STATE1 - nothing will be copied");
                    }

                    // don't do the copy now, just update the position pointer
                    this.oByteBuffer.position(newPosition);

                    int min = cachePosition;
                    int max = newPosition - 1;

                    // in STATE1 readMin and readMax keep track of the data that will
                    // need to be moved up to the nonDirect buffer upon entering STATE2.
                    // This area can be expanded to contain some bytes which were not
                    // read into, since nothing has been put into the NonDirect buffer,
                    // so any gaps in the read data will be uninitialized data anyway.
                    if ((wsBBRoot.readMin == -1) || (min < wsBBRoot.readMin)) {
                        wsBBRoot.readMin = min;
                    }
                    if ((wsBBRoot.readMax == -1) || (max > wsBBRoot.readMax)) {
                        wsBBRoot.readMax = max;
                    }

                    // if getMin and getMax are not outside of the new read, then reset them,
                    // so that the next get(...) will pull up the new data.
                    if ((wsBBRoot.getMax >= wsBBRoot.readMin)
                        && (wsBBRoot.getMin <= wsBBRoot.readMax)) {

                        wsBBRoot.getMax = -1;
                        wsBBRoot.getMin = -1;
                    }

                } else {
                    // actionState must equal COPY_WHEN_NEEDED_STATE2 or
                    // BUFFER_MGMT_COPY_ALL_FINAL (if another thread just changed it).
                    //

                    if (wsBBRoot.actionState == PooledWsByteBufferImpl.COPY_WHEN_NEEDED_STATE2) {
                        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                            Tr.debug(tc, "actionState: STATE2, first copy up any previously read data");
                        }
                        // first copy up to the nonDirect buffer any data that was read before
                        // entering STATE 2
                        if ((wsBBRoot.readMin != -1) && (wsBBRoot.readMax != -1)) {
                            moveUpUsingGetMinMax(wsBBRoot.readMin, wsBBRoot.readMax, 0);
                        }
                    }

                    this.wsBBRoot.actionState = PooledWsByteBufferImpl.COPY_ALL_FINAL;
                    this.quickBufferAction = NOT_ACTIVATED;

                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "actionState: COPY_ALL_FINAL, copy currently read data to NonDirect buffer ");
                    }

                    // copy the bytes read from the old position
                    this.oWsBBDirect.position(cachePosition);

                    if (bytesRead == -1) {
                        // copy all the bytes up to the limit
                        this.oWsBBDirect.get(oByteBuffer.array(), cachePosition + oByteBuffer.arrayOffset(), oByteBuffer.remaining());
                    } else if (bytesRead > 0) {
                        // copy just the bytes that were read
                        this.oWsBBDirect.get(oByteBuffer.array(), cachePosition + oByteBuffer.arrayOffset(), bytesRead);
                    }

                    // set to the position
                    this.oByteBuffer.position(newPosition);

                }
            } // end-sync
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "copyFromDirectBuffer");
        }
    }
1156751
def _recv_frameify(self, data):
        

        # Get the state and framer
        state = self._recv_framer_state
        framer = None

        # Grab off as many frames as we can
        frameify = None
        while True:
            # Check if we need to change framers
            if framer != self._recv_framer:
                # Notify the currently-running framer
                if frameify:
                    try:
                        frameify.throw(framers.FrameSwitch)
                    except StopIteration:
                        pass

                # Set up the new framer
                framer = self._recv_framer
                state._reset(framer)
                frameify = framer.frameify(state, data)
                data = ''  # Now part of the state's buffer

            # Get the next frame
            try:
                frame = frameify.next()
            except StopIteration:
                # OK, we've extracted as many frames as we can
                break

            # OK, send the frame to the application
            if self._application:
                self._application.recv_frame(frame)
1334031
public static ByteBuffer readBytes(ByteBuffer bb, int length)
    {
        ByteBuffer copy = bb.duplicate();
        copy.limit(copy.position() + length);
        bb.position(bb.position() + length);
        return copy;
    }
744267
public void copyBufferStateFrom(WstxInputData src)
    {
        mInputBuffer = src.mInputBuffer;
        mInputPtr = src.mInputPtr;
        mInputEnd = src.mInputEnd;

        mCurrInputProcessed = src.mCurrInputProcessed;
        mCurrInputRow = src.mCurrInputRow;
        mCurrInputRowStart = src.mCurrInputRowStart;
    }