Create bytes consumer, either reading or skipping records.
343803
function createReader(noDecode, type) {
  if (noDecode) {
    return (function (skipper) {
      return function (tap) {
        var pos = tap.pos;
        skipper(tap);
        return tap.buf.slice(pos, tap.pos);
      };
    })(type._skip);
  } else {
    return function (tap) { return type._read(tap); };
  }
}
1365012
def consume(self, length):
		
		self.buff = io.BytesIO(self.getvalue()[length:])
		return self
661680
def record(self, i=0):
        """"""
        f = self.__getFileObj(self.dbf)
        if not self.numRecords:
            self.__dbfHeader()
        i = self.__restrictIndex(i)
        recSize = self.__recordFmt()[1]
        f.seek(0)
        f.seek(self.__dbfHeaderLength() + (i * recSize))
        return self.__record()
784902
def create(from_records, to_records, index_columns, ignore_columns=None):
    
    from_indexed = records.index(from_records, index_columns)
    to_indexed = records.index(to_records, index_columns)

    if ignore_columns is not None:
        from_indexed = records.filter_ignored(from_indexed, ignore_columns)
        to_indexed = records.filter_ignored(to_indexed, ignore_columns)

    return create_indexed(from_indexed, to_indexed, index_columns)
991307
def read(self):
    
    data = None
    while True:
      last_offset = self.tell()
      try:
        (chunk, record_type) = self.__try_read_record()
        if record_type == _RECORD_TYPE_NONE:
          self.__sync()
        elif record_type == _RECORD_TYPE_FULL:
          if data is not None:
            logging.warning(
                "Ordering corruption: Got FULL record while already "
                "in a chunk at offset %d", last_offset)
          return chunk
        elif record_type == _RECORD_TYPE_FIRST:
          if data is not None:
            logging.warning(
                "Ordering corruption: Got FIRST record while already "
                "in a chunk at offset %d", last_offset)
          data = chunk
        elif record_type == _RECORD_TYPE_MIDDLE:
          if data is None:
            logging.warning(
                "Ordering corruption: Got MIDDLE record before FIRST "
                "record at offset %d", last_offset)
          else:
            data += chunk
        elif record_type == _RECORD_TYPE_LAST:
          if data is None:
            logging.warning(
                "Ordering corruption: Got LAST record but no chunk is in "
                "progress at offset %d", last_offset)
          else:
            result = data + chunk
            data = None
            return result
        else:
          raise errors.InvalidRecordError(
              "Unsupported record type: %s" % record_type)

      except errors.InvalidRecordError, e:
        logging.warning("Invalid record encountered at %s (%s). Syncing to "
                        "the next block", last_offset, e)
        data = None
        self.__sync()
425576
public Reader createReader(byte[] cachedBytes) throws IOException {
	if (cachedBytes != null) {
	    return new InputStreamReader(new ByteArrayInputStream(cachedBytes));
	}
        if (inputStream != null) {
            return new InputStreamReader(inputStream, charset);
        }
        if (reader != null) {
            return reader;
        }
        return new InputStreamReader(new FileInputStream(file), charset);
    }
864081
def from_bytes(cls, bitstream):
        '''
        
        '''
        record = cls()

        # Convert to ConstBitStream (if not already provided)
        if not isinstance(bitstream, ConstBitStream):
            if isinstance(bitstream, Bits):
                bitstream = ConstBitStream(auto=bitstream)
            else:
                bitstream = ConstBitStream(bytes=bitstream)

        # Read the priorities and weights
        (record.priority, record.weight, record.m_priority,
         record.m_weight) = bitstream.readlist('4*uint:8')

        # Read over unused flags
        record._reserved1 = bitstream.read(13)

        # Read the flags
        (record.local,
         record.probed_locator,
         record.reachable) = bitstream.readlist('3*bool')

        # Read the locator
        record.address = read_afi_address_from_bitstream(bitstream)

        # Verify that the properties make sense
        record.sanitize()

        return record
807853
@Override
	public StringValue readRecord(StringValue reuse, byte[] bytes, int offset, int numBytes) {
		if (this.ascii) {
			reuse.setValueAscii(bytes, offset, numBytes);
			return reuse;
		}
		else {
			ByteBuffer byteWrapper = this.byteWrapper;
			if (bytes != byteWrapper.array()) {
				byteWrapper = ByteBuffer.wrap(bytes, 0, bytes.length);
				this.byteWrapper = byteWrapper;
			}
			byteWrapper.limit(offset + numBytes);
			byteWrapper.position(offset);

			try {
				CharBuffer result = this.decoder.decode(byteWrapper);
				reuse.setValue(result);
				return reuse;
			}
			catch (CharacterCodingException e) {
				if (skipInvalidLines) {
					return null;
				} else {
					byte[] copy = new byte[numBytes];
					System.arraycopy(bytes, offset, copy, 0, numBytes);
					throw new RuntimeException("Line could not be encoded: " + Arrays.toString(copy), e);
				}
			}
		}
	}
581026
def from_bytes(cls, bitstream, prefix_len=None):
        '''
        
        '''
        # Convert to ConstBitStream (if not already provided)
        if not isinstance(bitstream, ConstBitStream):
            if isinstance(bitstream, Bits):
                bitstream = ConstBitStream(auto=bitstream)
            else:
                bitstream = ConstBitStream(bytes=bitstream)

        # Skip the reserved bits
        rsvd1 = bitstream.read(8)

        # Read the flags (and ignore them, no flags are defined yet)
        flags = bitstream.readlist('8*bool')

        # Read the type
        type_nr = bitstream.read('uint:8')

        # Skip the reserved bits
        rsvd2 = bitstream.read(8)

        # Read the length
        length = bitstream.read('uint:16')

        # Read the data
        data = bitstream.read(length * 8)

        # Look for the right class
        from pylisp.utils.lcaf import type_registry
        type_class = type_registry.get_type_class(type_nr)
        if not type_class:
            raise ValueError("Can't handle LCAF type {0}".format(type_nr))

        # Let the specific class handle it from now on
        return type_class._from_data_bytes(data, prefix_len,
                                           rsvd1, flags, rsvd2)
1304372
function ProtoReader(data, zeroCopy) {
  if (!(this instanceof ProtoReader))
    return new ProtoReader(data, zeroCopy);

  BufferReader.call(this, data, zeroCopy);
}
1141517
def skipBytes(self, nroBytes):
        
        self.data.seek(nroBytes + self.data.tell())
127836
def _readbytes(self, length, start):
        """"""
        assert length % 8 == 0
        assert start + length <= self.len
        if not (start + self._offset) % 8:
            return bytes(self._datastore.getbyteslice((start + self._offset) // 8,
                                                      (start + self._offset + length) // 8))
        return self._slice(start, start + length).tobytes()
741119
def _make_chunk_iter(stream, limit, buffer_size):
    """"""
    if isinstance(stream, (bytes, bytearray, text_type)):
        raise TypeError('Passed a string or byte object instead of '
                        'true iterator or stream.')
    if not hasattr(stream, 'read'):
        for item in stream:
            if item:
                yield item
        return
    if not isinstance(stream, LimitedStream) and limit is not None:
        stream = LimitedStream(stream, limit)
    _read = stream.read
    while 1:
        item = _read(buffer_size)
        if not item:
            break
        yield item
946643
def skip(self, num_bytes):
        """"""
        if num_bytes is None:
            self._offset = len(self._data)
        else:
            self._offset += num_bytes
500416
public long skip(long bytes) throws IOException {
        long pos = randomFile.getFilePointer();
        randomFile.seek(pos + bytes);
        return randomFile.getFilePointer() - pos;
    }
1267553
def _setbytes_unsafe(self, data, length, offset):
        """"""
        self._datastore = ByteStore(data[:], length, offset)
        assert self._assertsanity()
1072988
def from_bytes(cls, bitstream):
        '''
        
        '''
        packet = cls()

        # Convert to ConstBitStream (if not already provided)
        if not isinstance(bitstream, ConstBitStream):
            if isinstance(bitstream, Bits):
                bitstream = ConstBitStream(auto=bitstream)
            else:
                bitstream = ConstBitStream(bytes=bitstream)

        # Read the type
        type_nr = bitstream.read('uint:4')
        if type_nr != packet.message_type:
            msg = 'Invalid bitstream for a {0} packet'
            class_name = packet.__class__.__name__
            raise ValueError(msg.format(class_name))

        # Read the flags
        packet.proxy_map_reply = bitstream.read('bool')

        # Skip reserved bits
        packet._reserved1 = bitstream.read(1)

        # NATT bits
        has_xtr_site_id = bitstream.read('bool')
        packet.for_rtr = bitstream.read('bool')

        # Skip reserved bits
        packet._reserved2 = bitstream.read(15)

        # Read the rest of the flags
        packet.want_map_notify = bitstream.read('bool')

        # Store the record count until we need it
        record_count = bitstream.read('uint:8')

        # Read the nonce
        packet.nonce = bitstream.read('bytes:8')

        # Read the key id
        packet.key_id = bitstream.read('uint:16')

        # Read the authentication data
        data_length = bitstream.read('uint:16')
        packet.authentication_data = bitstream.read('bytes:%d' % data_length)

        # Read the records
        for dummy in range(record_count):
            record = MapRegisterRecord.from_bytes(bitstream)
            packet.records.append(record)

        # Read the xtr-id and site-id
        if has_xtr_site_id:
            packet.xtr_id = bitstream.read('uint:128')
            packet.site_id = bitstream.read('uint:64')

        # Verify that the properties make sense
        packet.sanitize()

        return packet