Read the next data frame.
@return  The next frame
@throws IOException  on read error
186355
public Frame readNextFrame() throws IOException {
        //boolean got_a_frame;
        
        try {
            while (true) {
                //switch (state) {
                //case STREAM_DECODER_SEARCH_FOR_METADATA :
                //    findMetadata();
                //    break;
                //case STREAM_DECODER_READ_METADATA :
                //    readMetadata(); /* above function sets the status for us */
                //    break;
                //case DECODER_SEARCH_FOR_FRAME_SYNC :
                findFrameSync(); /* above function sets the status for us */
                //System.exit(0);
                //break;
                //case DECODER_READ_FRAME :
                try {
                    readFrame();
                    return frame;
                } catch (FrameDecodeException e) {
                    badFrames++;
                }
                //break;
                //case DECODER_END_OF_STREAM :
                //case DECODER_ABORTED :
                //    return null;
                //default :
                //    return null;
                //}
            }
        } catch (EOFException e) {
            eof = true;
        }
        return null;
    }
901472
public TarEntry getNextEntry() throws IOException {
		closeCurrentEntry();

		byte[] header = new byte[TarConstants.HEADER_BLOCK];
		byte[] theader = new byte[TarConstants.HEADER_BLOCK];
		int tr = 0;

		// Read full header
		while (tr < TarConstants.HEADER_BLOCK) {
			int res = read(theader, 0, TarConstants.HEADER_BLOCK - tr);

			if (res < 0) {
				break;
			}

			System.arraycopy(theader, 0, header, tr, res);
			tr += res;
		}

		// Check if record is null
		boolean eof = true;
		for (byte b : header) {
			if (b != 0) {
				eof = false;
				break;
			}
		}

		if (!eof) {
			currentEntry = new TarEntry(header);
		}

		return currentEntry;
	}
366881
public File next() throws IOException {
        if (stack.isEmpty()) {
            current = null;
            return null;
        } else {
            current = stack.removeLast();
            if (current.isDirectory()) {
                if (stack.size() < rootCount) {
                    rootCount = stack.size();
                }
                addReverse(current.listFiles());
                return next();
            } else {
                return current;
            }
        }
    }
166638
private boolean readNextRecord() throws IOException {
		boolean recordFound = false;
		while (!recordFound) {
			// no more records left
			if (numReadRecords >= numTotalRecords) {
				return false;
			}

			try {
				if (numReadRecords == numRecordsUpToCurrentBlock) {
					// advance to next block
					PageReadStore pages = reader.readNextRowGroup();
					recordReader = createRecordReader(pages);
					numRecordsUpToPreviousBlock = numRecordsUpToCurrentBlock;
					numRecordsUpToCurrentBlock += pages.getRowCount();
					currentBlock++;
				}

				numReadRecords++;
				try {
					readRecord = recordReader.read();
					readRecordReturned = false;
				} catch (RecordMaterializationException e) {
					String errorMessage = String.format(
						"skipping a corrupt record in block number [%d] record number [%s] of file %s",
						currentBlock, numReadRecords - numRecordsUpToPreviousBlock, reader.getFile());

					if (!skipCorruptedRecord) {
						LOG.error(errorMessage);
						throw e;
					} else {
						LOG.warn(errorMessage);
					}
					continue;
				}

				if (readRecord == null) {
					readRecordReturned = true;
					numReadRecords = numRecordsUpToCurrentBlock;
					LOG.debug("filtered record reader reached end of block");
					continue;
				}

				recordFound = true;
				LOG.debug("read value: {}", readRecord);
			} catch (RecordMaterializationException e) {
				LOG.error(String.format("Can not read value at %d in block %d in file %s",
					numReadRecords - numRecordsUpToPreviousBlock, currentBlock, reader.getFile()), e);
				if (!skipCorruptedRecord) {
					throw e;
				}
				return false;
			}
		}

		return true;
	}
431641
public String next() throws IOException {
        if (done) {
            return null;
        }
        for (;;) {
            if (line == null) {
                line = reader.readLineSkippingComments();
                if (line == null) {
                    done = true;
                    return null;
                }
                pos = 0;
            }
            buf.setLength(0);
            lastpos = pos;
            pos = nextToken(pos);
            if (pos < 0) {
                line = null;
                continue;
            }
            return buf.toString();
        }
    }
1207470
public byte[] readRecord() throws IOException {
        if (this.debug) {
            System.err.println("ReadRecord: recIdx = " + this.currRecIdx + " blkIdx = " + this.currBlkIdx);
        }

        if (this.inStream == null) {
            throw new IOException("reading from an output buffer");
        }

        if (this.currRecIdx >= this.recsPerBlock) {
            if (!this.readBlock()) {
                return null;
            }
        }

        byte[] result = new byte[this.recordSize];

        System.arraycopy(this.blockBuffer, (this.currRecIdx * this.recordSize), result, 0, this.recordSize);

        this.currRecIdx++;

        return result;
    }
887442
public int read() throws IOException {
    if (totalRead >= totalExpected) {
      return -1;
    }

    int result = in.read();
    if (result != -1) {
      totalRead++;
    }
    return result;
  }
1142473
public byte[] read() throws IOException {
        if (m_exception.get() != null) {
            throw m_exception.get();
        }

        byte bytes[] = null;
        if (m_activeConverters.get() == 0) {
            bytes = m_available.poll();
        } else {
            try {
                bytes = m_available.take();
            } catch (InterruptedException e) {
                throw new IOException(e);
            }
        }
        if (bytes != null) {
            m_availableBytes.addAndGet(-1 * bytes.length);
        }
        return bytes;
    }
681887
public int read() throws IOException
    {
        if (_closed)
            return -1;

        if (_packet.unconsumedData()<=0)
        {
            fillPacket();
            if (_packet.unconsumedData()<=0)
            {
                _closed=true;
                return -1;
            }
        }
        return _packet.getByte();
    }
1252683
public String[] readNext() {
    String[] result = null;
    do {
      String nextLine = getNextLine();
      if (!hasNext) { return result; // should throw if still pending?
      }
      String[] r = parser.parseLineMulti(nextLine);
      if (r.length > 0) {
        if (result == null) {
          result = r;
        } else {
          String[] t = new String[result.length + r.length];
          System.arraycopy(result, 0, t, 0, result.length);
          System.arraycopy(r, 0, t, result.length, r.length);
          result = t;
        }
      }
    } while (parser.isPending());
    return result;
  }
810743
private void readNextBlock()
            throws IOException
    {
        lastReadInputCheckpoint = input.getCheckpoint();

        int control = input.read();
        if (control == -1) {
            throw new OrcCorruptionException(input.getOrcDataSourceId(), "Read past end of buffer RLE byte");
        }

        offset = 0;

        // if byte high bit is not set, this is a repetition; otherwise it is a literal sequence
        if ((control & 0x80) == 0) {
            length = control + MIN_REPEAT_SIZE;

            // read the repeated value
            int value = input.read();
            if (value == -1) {
                throw new OrcCorruptionException(input.getOrcDataSourceId(), "Reading RLE byte got EOF");
            }

            // fill buffer with the value
            Arrays.fill(buffer, 0, length, (byte) value);
        }
        else {
            // length is 2's complement of byte
            length = 0x100 - control;

            // read the literals into the buffer
            input.readFully(buffer, 0, length);
        }
    }
326508
public Reader readRaw() throws IOException {
        try {
            InputStream fileInputStream = Files.newInputStream(file.toPath());
            try {
                return new InputStreamReader(fileInputStream, sniffEncoding());
            } catch (IOException ex) {
                // Exception may happen if we fail to find encoding or if this encoding is unsupported.
                // In such case we close the underlying stream and rethrow.
                Util.closeAndLogFailures(fileInputStream, LOGGER, "FileInputStream", file.toString());
                throw ex;
            }
        } catch (InvalidPathException e) {
            throw new IOException(e);
        }
    }
865146
public static DataReader get() throws IOException {
    if (!instance.initialized) {
      long start = System.currentTimeMillis();
      instance.init();
      long elapsed = System.currentTimeMillis() - start;
      System.out.printf("Loaded CLDR data in %d ms.\n", elapsed);
    }
    return instance;
  }
1255785
public synchronized int read() throws IOException
    {
        int b;
        if (_pos >=_avail)
            fill();
        if (_pos >=_avail)
            b=-1;
        else
            b=_buf[_pos++]&255;
        
        return b;
    }
105508
public void read() throws IOException {
    readFileId();
    in.resetCRC();

    long startcode = in.readStartCode();

    while (true) {
      // Start parsing main and stream information
      header = new MainHeaderPacket();

      if (!Startcode.MAIN.equalsCode(startcode)) {
        throw new IOException(String.format("expected main header found: 0x%X", startcode));
      }

      header.read(in, startcode);
      startcode = readReservedHeaders();

      streams.clear();
      for (int i = 0; i < header.streamCount; i++) {
        if (!Startcode.STREAM.equalsCode(startcode)) {
          throw new IOException(String.format("expected stream header found: 0x%X", startcode));
        }

        StreamHeaderPacket streamHeader = new StreamHeaderPacket();
        streamHeader.read(in, startcode);

        Stream stream = new Stream(header, streamHeader);
        streams.add(stream);
        listener.stream(stream);

        startcode = readReservedHeaders();
      }

      while (Startcode.INFO.equalsCode(startcode)) {
        new Packet().read(in, startcode); // Discard for the moment
        startcode = readReservedHeaders();
      }

      if (Startcode.INDEX.equalsCode(startcode)) {
        new Packet().read(in, startcode); // Discard for the moment
        startcode = in.readStartCode();
      }

      // Now main frame parsing loop
      while (!Startcode.MAIN.equalsCode(startcode)) {

        if (Startcode.SYNCPOINT.equalsCode(startcode)) {
          new Packet().read(in, startcode); // Discard for the moment
          startcode = in.readStartCode();
        }

        if (Startcode.isPossibleStartcode(startcode)) {
          throw new IOException("expected framecode, found " + Startcode.toString(startcode));
        }

        Frame f = new Frame();
        f.read(this, in, (int) startcode);

        listener.frame(f);

        try {
          startcode = readReservedHeaders();
        } catch (java.io.EOFException e) {
          return;
        }
      }
    }
  }
275886
public int read() throws IOException {
        logger.debug("read()");
        logger.debug("count={} pos={}", count, pos);
        return (pos < count) ? (buf[pos++] & 0xff) : (-1);
    }
861361
public byte readByte() throws IOException {

		// buffer depleted ?
		if (head == tail) {
			head = 0;
			// Refill.
			tail = input.read(buffer, head, bufSize);
			if (tail == -1) {
				// no more data available.
				throw new IOException("No more data is available");
			}
		}

		return buffer[head++];
	}