Stream zero or more high-scoring segment pairs from the specified readable.

@param readable readable to stream from, must not be null
@param listener event based listener callback, must not be null
@throws IOException if an I/O error occurs
496226
public static void stream(final Readable readable, final HspListener listener) throws IOException {
        checkNotNull(readable);
        checkNotNull(listener);

        HspLineProcessor lineProcessor = new HspLineProcessor(listener);
        CharStreams.readLines(readable, lineProcessor);
    }
656817
public static Iterable<BedRecord> read(final Readable readable) throws IOException {
        checkNotNull(readable);
        Collect collect = new Collect();
        stream(readable, collect);
        return collect.records();
    }
389899
private void closeStream(final Throwable throwable) {
    if (stream != null) {
      stream.onCompleted();
      stream = null;
    }

    if (isActive.getAndSet(false)) {
      userCallbackExecutor.execute(
          new Runnable() {
            @Override
            public void run() {
              listener.onEvent(
                  null,
                  throwable instanceof FirestoreException
                      ? (FirestoreException) throwable
                      : FirestoreException.apiException(
                          new ApiException(
                              throwable,
                              GrpcStatusCode.of(getStatus(throwable).getCode()),
                              false)));
            }
          });
    }
  }
535328
@Override
    public int read(byte[] output, int offset, int length) throws IOException {
        synchronized(this){
            int value = 0;
            if(closed) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isErrorEnabled())
                    Tr.error(tc, "stream.is.closed.no.read.write");
                throw new IOException(Tr.formatMessage(tc, "stream.is.closed.no.read.write"));
            }
            if(output == null){
                if (TraceComponent.isAnyTracingEnabled() && tc.isErrorEnabled())
                    Tr.error(tc, "read.write.bytearray.null");
                throw new NullPointerException(Tr.formatMessage(tc, "read.write.bytearray.null"));
            }
            if((offset < 0) || (length < 0) || (length > (output.length - offset))){
                if (TraceComponent.isAnyTracingEnabled() && tc.isErrorEnabled())
                    Tr.error(tc, "read.write.offset.length.bytearraylength", new Object[] {offset, length, output.length});
                throw new IndexOutOfBoundsException(Tr.formatMessage(tc, "read.write.offset.length.bytearraylength", new Object[] {offset, length, output.length}));
            }

            if (this._inBuffer != null) {
                value = _inBuffer.read(output, offset, length);
            }
            else {
                value = this.in.read(output, offset, length);
            }

            return value;
        }
    }
221919
@Override
    public int read(byte[] output) throws IOException {
        
        //Return -1 here because if we are closed or finished, we're at the end of the stream
        if(isClosed || isFinished()){
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                Tr.debug(tc, "Nothing to read, stream is closed : " + isClosed + ", or finished : " + isFinished());
            return -1;
        }
        
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "read" , "SRTInputStream31.read(byte[])");
        }
        if(output == null){
            if (TraceComponent.isAnyTracingEnabled() && tc.isErrorEnabled())
                Tr.error(tc, "read.write.bytearray.null");
            throw new NullPointerException(Tr.formatMessage(tc, "read.write.bytearray.null"));
        }
        
        int returnSize = 0;
        
        if(this.request.isAsyncStarted() && (this.getReadListener()!= null)){
            synchronized(this){
                
                //Check if isReady had returned false. If it did then an IllegalArgumentException will be thrown if a listener is set
                isReadyFalseCheck();
                returnSize = super.read(output);
            }
        }else{
            returnSize = super.read(output);
        }
        
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "read" , "SRTInputStream31.read(byte[]) : " + returnSize);
        }
        
        return returnSize;
    }
892830
public boolean process(ElementListener listener) {
        try {
            Chunk chunk;
            Iterator i = getChunks().iterator();
            boolean localDestination = (reference != null && reference.startsWith("#"));
            boolean notGotoOK = true;
            while (i.hasNext()) {
                chunk = (Chunk) i.next();
                if (name != null && notGotoOK && !chunk.isEmpty()) {
                    chunk.setLocalDestination(name);
                    notGotoOK = false;
                }
                if (localDestination) {
                    chunk.setLocalGoto(reference.substring(1));
                }
                listener.add(chunk);
            }
            return true;
        }
        catch(DocumentException de) {
            return false;
        }
    }
1360899
public void readObject (ObjectInputStream in)
        throws IOException, ClassNotFoundException
    {
        int ecount = in.readInt();
        for (int ii = 0; ii < ecount; ii++) {
            @SuppressWarnings("unchecked") K key = (K)in.readObject();
            @SuppressWarnings("unchecked") V value = (V)in.readObject();
            put(key, value);
        }
    }
312310
public static String readFully(BufferedReader reader) throws IOException {
    StringBuilder sb = new StringBuilder();
    for (String line; (line = reader.readLine()) != null; ) {
      sb.append(line);
    }
    return sb.toString();
  }
1278142
static void parse(final Readable readable, final ParseListener listener)
		throws IOException
	{
		if (readable == null)
		{
			throw new IllegalArgumentException("readable must not be null");
		}
		FastqParserLineProcessor lineProcessor = new FastqParserLineProcessor(listener);
		CharStreams.readLines(readable, lineProcessor);
		if (lineProcessor.getState() == State.COMPLETE)
		{
			listener.complete();
			lineProcessor.setState(State.DESCRIPTION);
		}
		if (lineProcessor.getState() != State.DESCRIPTION)
		{
			throw new IOException("truncated sequence"); // at line " + lineNumber);
		}
	}
1139527
private void readFully(InputStream in, byte[] bytes) throws IOException {
        int read = ByteStreams.read(in, bytes, 0, bytes.length);
        if (read == 0) {
            throw new NoBytesReadException();
        } else if (read != bytes.length) {
            throw new EOFException("reached end of stream after reading "
                    + read + " bytes; " + bytes.length + " bytes expected");
        }
    }
114967
public void defaultReadObject ()
        throws IOException, ClassNotFoundException
    {
        // sanity check
        if (_current == null) {
            throw new RuntimeException("defaultReadObject() called illegally.");
        }

        // read the instance data
        _streamer.readObject(_current, this, false);
    }
1206025
public void onReadFailure(Throwable t) {
        ConnectionState event = null;
        synchronized (this) {
            if (this.state == ConnectionState.CLOSED) {
                // already closed
                return;
            }

            // Build out Close Reason
            String reason = "WebSocket Read Failure";
            if (t instanceof EOFException) {
                reason = "WebSocket Read EOF";
                Throwable cause = t.getCause();
                if ((cause != null) && (StringUtils.hasText(cause.getMessage()))) {
                    reason = "EOF: " + cause.getMessage();
                }
            } else {
                if (StringUtils.hasText(t.getMessage())) {
                    reason = t.getMessage();
                }
            }

            CloseInfo close = new CloseInfo(StatusCode.ABNORMAL, reason);

            finalClose.compareAndSet(null, close);

            this.cleanClose = false;
            this.state = ConnectionState.CLOSED;
            this.closeInfo = close;
            this.inputAvailable = false;
            this.outputAvailable = false;
            this.closeHandshakeSource = CloseHandshakeSource.ABNORMAL;
            event = this.state;
        }
        notifyStateListeners(event);
    }
520933
public static void readFully(Reader reader, char[] buffer, int offset) throws IOException {
    int originalOffset = offset;
    int expected = buffer.length - offset;
    while (offset < buffer.length) {
      int numRead = reader.read(buffer, offset, buffer.length - offset);
      if (numRead < 0) {
        throw new IOException(
                String.format("Reached end of stream earlier than expected. Expected to read %d bytes. Actual: %d",
                expected, offset - originalOffset));
      }
      offset += numRead;
    }
  }
1262664
function ReadableStream(options, cursor) {
  if (cursor) this._cursor = cursor;
  this._pending = 0; // How many time we called _read while no cursor was available
  this._index = 0;
  this._maxRecursion = 1000; // Hardcoded
  this._highWaterMark = options.highWaterMark;
  this._closed = false;

  Readable.call(this, {
    objectMode: true,
    highWaterMark: this._highWaterMark
  });
}
481456
public int readMarker(SequenceFile.Reader reader) throws IOException {
    if (valueBytes == null) {
      valueBytes = reader.createValueBytes();
    }
    rawKey.reset();
    rawValue.reset();

    // valueBytes need not be reset since nextRaw call does it (and it is a private method)
    int status = reader.nextRaw(rawKey, valueBytes);

    // if we reach EOF, return -1
    if (status == -1) {
      return -1;
    }

    // Check if the marker key is valid and return the count
    if (isMarkerValid()) {
      valueBytes.writeUncompressedBytes(rawValue);
      rawValue.flush();
      // rawValue.getData() may return a larger byte array but Ints.fromByteArray will only read the first four bytes
      return Ints.fromByteArray(rawValue.getData());
    }

    // EOF not reached and marker is not valid, then thrown an IOException since we can't make progress
    throw new IOException(String.format("Invalid key for num entries appended found %s, expected : %s",
                                        new String(rawKey.getData()), TxConstants.TransactionLog.NUM_ENTRIES_APPENDED));
  }
666433
public static void parse(final Readable readable, final VcfParseListener listener) throws IOException {
        VcfParser.parse(readable, listener);
    }
463020
@CanIgnoreReturnValue
  public static long exhaust(Readable readable) throws IOException {
    long total = 0;
    long read;
    CharBuffer buf = createBuffer();
    while ((read = readable.read(buf)) != -1) {
      total += read;
      buf.clear();
    }
    return total;
  }