Reads PCapPacketHeader data from the given stream.
548997
def read (self, stream):
      """"""
      self._data = stream.read(self._size)

      if len(self._data) >= self._size:
          values = struct.unpack(self._swap + self._format, self._data)
      else:
          values = None, None, None, None

      self.ts_sec   = values[0]
      self.ts_usec  = values[1]
      self.incl_len = values[2]
      self.orig_len = values[3]
693538
def reader(stream):
    """"""
    for line in stream:
        item = Item()
        item.json = line
        yield item
1268757
function readStream(stream) {
  return new Promise(function(resolve) {
    stream.pipe(concat(function(data) {
      resolve(data.toString().trim());
    }));
  });
}
817484
private void readMbean() {
		if (clazz == null) {
			return;
		}
		try {
			if (isUnixOS) {
				long openFiles = getValue("OpenFileDescriptorCount");
				long maxOpenFiles = getValue("MaxFileDescriptorCount");

				long freePhysicalMemorySize = getValue("FreePhysicalMemorySize");
				long totalPhysicalMemorySize = getValue("TotalPhysicalMemorySize");

				long processTime = getValue("ProcessCpuTime");

				double processCPULoad = getDoubleValue("ProcessCpuLoad");
				double systemCPULoad = getDoubleValue("SystemCpuLoad");

				long processors = getValue("AvailableProcessors");

				stats.update((int) openFiles, (int) maxOpenFiles, freePhysicalMemorySize, totalPhysicalMemorySize, processTime, (int) processors, processCPULoad, systemCPULoad);

			} else if (isWindowsOS) {
				long processors = getValue("AvailableProcessors");
				double systemCPULoad = readWindowsCPULoad();

				long totalPhysicalMemorySize = readWindowsTotalMemory();
				long freePhysicalMemorySize = readWindowsFreeMemory();

				stats.update(-1, -1, freePhysicalMemorySize, totalPhysicalMemorySize, -1, (int) processors, -1, systemCPULoad);

			} else {
				long processors = getValue("AvailableProcessors");

				stats.update(-1, -1, -1, -1, -1, (int) processors, -1, -1);
			}

		} catch (Exception e) {
			log.warn("Couldn't read value due to", e);
		}
	}
1169028
private void readPICTHeader(final ImageInputStream pStream) throws IOException {
        pStream.seek(0l);

        try {
            readPICTHeader0(pStream);
        }
        catch (IIOException e) {
            // Rest and try again
            pStream.seek(0l);

            // Skip first 512 bytes
            PICTImageReaderSpi.skipNullHeader(pStream);
            readPICTHeader0(pStream);
        }
    }
947730
public static void readFrom(InputStream is, int needed, ByteBuffer buffer) throws IOException {
        ByteBuffer tmp = allocate(8192);

        while (needed > 0 && buffer.hasRemaining()) {
            int l = is.read(tmp.array(), 0, 8192);
            if (l < 0)
                break;
            tmp.position(0);
            tmp.limit(l);
            buffer.put(tmp);
        }
    }
739947
def read(self, stream):
        """"""
        def read_it(stream):
            bytes = stream.read()
            transportIn = TMemoryBuffer(bytes)
            protocolIn = TBinaryProtocol.TBinaryProtocol(transportIn)
            topology = StormTopology()
            topology.read(protocolIn)
            return topology
            
        if isinstance(stream, six.string_types):
            with open(stream, 'rb') as f:
                return read_it(f)
        else:
            return read_it(stream)
370270
def Read(self, length=None):
    """"""

    if self.progress_callback:
      self.progress_callback()

    available_to_read = max(0, (self.size or 0) - self.offset)
    if length is None:
      to_read = available_to_read
    else:
      to_read = min(length, available_to_read)

    with FileHandleManager(self.filename) as fd:
      offset = self.file_offset + self.offset
      pre_padding = offset % self.alignment

      # Due to alignment we read some more data than we need to.
      aligned_offset = offset - pre_padding

      fd.Seek(aligned_offset)

      data = fd.Read(to_read + pre_padding)
      self.offset += len(data) - pre_padding

      return data[pre_padding:]
708624
def _read_txt(self, stream):
        '''
        

        '''
        self._data = _np.empty(self.count, dtype=self.dtype())

        k = 0
        for line in _islice(iter(stream.readline, b''), self.count):
            fields = iter(line.strip().split())
            for prop in self.properties:
                try:
                    self._data[prop.name][k] = prop._from_fields(fields)
                except StopIteration:
                    raise PlyElementParseError("early end-of-line",
                                               self, k, prop)
                except ValueError:
                    raise PlyElementParseError("malformed input",
                                               self, k, prop)
            try:
                next(fields)
            except StopIteration:
                pass
            else:
                raise PlyElementParseError("expected end-of-line",
                                           self, k)
            k += 1

        if k < self.count:
            del self._data
            raise PlyElementParseError("early end-of-file", self, k)
1029462
synchronized int read(byte[] data) {
        this.header = getHeaderParser().setData(data).parseHeader();
        if (data != null) {
            setData(header, data);
        }

        return status;
    }
298343
def read(self, stream):
        
        stack = self.stack
        while True:
            if stack[0]:  # will be true once one sexp has been parsed
                self.rest_string = stream
                return False
            c = stream.read(1)
            if not c:
                # no more stream and no complete sexp
                return True
            reading = type(stack[-1])
            self.sexp_string.write(c)

            if reading == tuple:
                if c in atom_end:
                    atom = stack.pop()
                    stack[-1].append(atom)
                    reading = type(stack[-1])
            if reading == list:
                if c == '(':
                    stack.append([])
                elif c == ')':
                    stack[-2].append(stack.pop())
                elif c == '"':
                    stack.append('')
                elif c == "'":
                    continue
                elif c in whitespace:
                    continue
                else:
                    stack.append(tuple())
            elif reading == str:
                if c == '"':
                    stack.pop()
                # escaped char coming up, so read ahead
                elif c == '\\':
                    self.sexp_string.write(stream.read(1))
97919
function readFromStream(stream, callback) {
  var buf = [];
  stream.on("data", onData);
  stream.on("end", onEnd);
  stream.on("error", onError);

  function onData(data) {
    buf.push(data);
  }

  function onEnd() {
    if (callback) callback(null, buf.join(""));
    callback = null;
  }

  function onError(err) {
    if (callback) callback(err);
    callback = null;
  }
}
1130795
@Override
    public Reader getNCharacterStream(int columnIndex) throws SQLException {
        checkColumnBounds(columnIndex);
        try {
            String value = table.getString(columnIndex - 1);
            if (!wasNull())
                return new StringReader(value);
            return null;
        } catch (Exception x) {
            throw SQLError.get(x);
        }
    }
196356
private void loadStream(InputStream stream)
    {
        int            iPos       = -1;
        String         strLine    = null;
        String         strSection = null;
        String         strRemarks = null;
        BufferedReader objBRdr    = null;
        InputStreamReader     objFRdr    = null;
        INISection     objSec     = null;

        try
        {
            objFRdr = new InputStreamReader(stream);
            if (objFRdr != null)
            {
                objBRdr = new BufferedReader(objFRdr);
                if (objBRdr != null)
                {
                    while (objBRdr.ready())
                    {
                        iPos = -1;
                        strLine  = null;
                        strLine = objBRdr.readLine().trim();
                        if (strLine == null)
                        {
                        }
                        else if (strLine.length() == 0)
                        {
                        }
                        else if (strLine.substring(0, 1).equals(";"))
                        {
                            if (strRemarks == null)
                                strRemarks = strLine.substring(1);
                            else if (strRemarks.length() == 0)
                                strRemarks = strLine.substring(1);
                            else
                                strRemarks = strRemarks + "\r\n" + strLine.substring(1);
                        }
                        else if (strLine.startsWith("[") && strLine.endsWith("]"))
                        {
                            // Section start reached create new section
                            if (objSec != null) 
                                this.mhmapSections.put(strSection.trim(), objSec);
                            objSec = null;
                            strSection = strLine.substring(1, strLine.length() - 1);
                            objSec = new INISection(strSection.trim(), strRemarks);
                            strRemarks = null;
                        }
                        else if ((iPos = strLine.indexOf("=")) > 0 && objSec != null)
                        {
                            // read the key value pair 012345=789
                            objSec.setProperty(strLine.substring(0, iPos).trim(), 
                                                strLine.substring(iPos + 1).trim(), 
                                                strRemarks);
                            strRemarks = null;
                        }
                        else 
                        {
                            objSec.setProperty(strLine, "", strRemarks);
                      
                        }
                    }
                    if (objSec != null)
                        this.mhmapSections.put(strSection.trim(), objSec);
                    this.mblnLoaded = true;
                }
            }
        }
        catch (FileNotFoundException FNFExIgnore)
        {
            this.mhmapSections.clear();
        }
        catch (IOException IOExIgnore)
        {
            this.mhmapSections.clear();
        }
        catch (NullPointerException NPExIgnore)
        {
            this.mhmapSections.clear();
        }
        finally
        {
            if (objBRdr != null)
            {
                closeReader(objBRdr);
                objBRdr = null;
            }
            if (objFRdr != null)
            {
                closeReader(objFRdr);
                objFRdr = null;
            }
            if (objSec != null) objSec = null;
        }
    }
272593
private void readObject(ObjectInputStream stream) throws IOException {
        try {
            decode(stream);
        } catch (InvalidKeyException e) {
            e.printStackTrace();
            throw new IOException("deserialized key is invalid: " +
                                  e.getMessage());
        }
    }
986567
public void readObject (ObjectInputStream in)
        throws IOException, ClassNotFoundException
    {
        // grab a timestamp noting when we were decoded from a raw buffer after being received over
        // the network
        _unpackStamp = System.currentTimeMillis();

        in.defaultReadObject();
    }
383818
def _pfp__parse(self, stream, save_offset=False):
        
        if save_offset:
            self._pfp__offset = stream.tell()

        res = utils.binary("")
        while True:
            byte = utils.binary(stream.read(self.read_size))
            if len(byte) < self.read_size:
                raise errors.PrematureEOF()
            # note that the null terminator must be added back when
            # built again!
            if byte == self.terminator:
                break
            res += byte
        self._pfp__value = res