Returns the the next n characters in the stream without advancing the
readers position.

@param n the number of characters to read
@return An array with guaranteed length n, with -1 being the value for
all elements at and after EOF.
@throws IOException
172509
int[] peek(int n) throws
      IOException
  {
    int[] buf = new int[n];
    Mark m = mark();
    boolean seenEOF = false;

    for (int i = 0; i < buf.length; i++)
    {
      if (!seenEOF)
      {
        buf[i] = next();
      }
      else
      {
        buf[i] = -1;
      }
      if (buf[i] == -1)
      {
        seenEOF = true;
      }
    }
    if (!seenEOF)
    {
      unread(buf, m);
    }
    else
    {
      List<Integer> ints = Lists.newArrayList();
      for (int aBuf : buf)
      {
        ints.add(aBuf);
        if (aBuf == -1)
        {
          break;
        }
      }
      unread(ints, m);
    }

    return buf;
  }
444013
public String next(int n) throws JSONException {
         if (n == 0) {
             return "";
         }

         char[] buffer = new char[n];
         int pos = 0;

         if (this.useLastChar) {
        	 this.useLastChar = false;
             buffer[0] = this.lastChar;
             pos = 1;
         }

         try {
             int len;
             while ((pos < n) && ((len = reader.read(buffer, pos, n - pos)) != -1)) {
                 pos += len;
             }
         } catch (IOException exc) {
             throw new JSONException(exc);
         }
         this.index += pos;

         if (pos < n) {
             throw syntaxError("Substring bounds error");
         }

         this.lastChar = buffer[n - 1];
         return new String(buffer);
     }
1182953
public char next() throws JSONException {
        if (this.useLastChar) {
        	this.useLastChar = false;
            if (this.lastChar != 0) {
            	this.index += 1;
            }
            return this.lastChar;
        } 
        int c;
        try {
            c = this.reader.read();
        } catch (IOException exc) {
            throw new JSONException(exc);
        }

        if (c <= 0) { // End of stream
        	this.lastChar = 0;
            return 0;
        } 
    	this.index += 1;
    	this.lastChar = (char) c;
        return this.lastChar;
    }
655334
public final String getNextLine() throws IOException {
    String str = null;
    if (buf_end - buf_pos <= 0) {
      if (fillBuffer() < 0) {
        return null;
      }
    }
    int lineend = -1;
    for (int i = buf_pos; i < buf_end; i++) {
      if (buffer[i] == '\n') {
        lineend = i;
        break;
      }
      // check for only '\r' as line end
      if ((i - buf_pos > 0) && buffer[i - 1] == '\r') {
        lineend = i - 1;
        break;
      }
    }
    if (lineend < 0) {
      StringBuilder input = new StringBuilder(256);
      int c;
      int lastC = 0;
      while (((c = read()) != -1) && (c != '\n') && (lastC != '\r')) {
        input.append((char) c);
        lastC = c;
      }
      if ((c == -1) && (input.length() == 0)) {
        return null;
      }
      return input.toString();
    }
    if (lineend > 0 && buffer[lineend] == '\n' && buffer[lineend - 1] == '\r') {
      str = new String(buffer, buf_pos, lineend - buf_pos - 1);
    } else {
      str = new String(buffer, buf_pos, lineend - buf_pos);
    }
    buf_pos = lineend + 1;
    return str;
  }
583321
public boolean next() throws IOException {
		boolean hasNext = true;
		try {
			oldId = stream.readInt();
			oldText = stream.readUTFAsArray();
		} catch (EOFException e) {
			hasNext = false;
		}
		return hasNext;
	}
695322
def read(self, n=None):
        
        response = ""
        while n is None or n > 0:
            c = self.stream.read(1)
            if c == "":
                break
            elif c == "<":
                c += self.stream.read(1)
                if c == "<?":
                    while True:
                        q = self.stream.read(1)
                        if q == ">":
                            break
                else:
                    response += c
                    if n is not None:
                        n -= len(c)
            else:
                response += c
                if n is not None:
                    n -= 1
        return response
1174837
public long skip(long n) throws IOException {
        long s = super.skip(n);
        if( s<n && filenames.hasNext() ) {
            cueStream();
            return s + skip(n-s);
        }
        return s;
    }
1369798
public long skip(long n) {
		long skipped=0L;
		int skip;
		while(n>0) {
			if(n<(skip=curr.remaining())) {
				curr.position(curr.position()+(int)n);
				skipped+=skip;
				n=0;
			} else {
				curr.position(curr.limit());
				
				skipped-=skip;
				if(idx<bbs.size()) {
					curr=bbs.get(idx++);
					n-=skip;
				} else {
					n=0;
				}
			}
		}
		return skipped;
	}
866796
public Reader readAll() throws IOException {
        return new InputStreamReader(new InputStream() {
            final Session session = source.open();
            public int read() throws IOException {
                byte[] buf = new byte[1];
                int n = session.read(buf);
                if(n==1)    return buf[0];
                else        return -1; // EOF
            }

            public int read(byte[] buf, int off, int len) throws IOException {
                return session.read(buf,off,len);
            }

            public void close() throws IOException {
                session.close();
            }
        });
    }
1049511
@Override
    public long skip(final long n) {
        if (n < 0) {
            throw new IllegalArgumentException(
                    "Number of characters to skip is less than zero: " + n);
        }
        if (idx >= charSequence.length()) {
            return EOF;
        }
        final int dest = (int)Math.min(charSequence.length(), idx + n);
        final int count = dest - idx;
        idx = dest;
        return count;
    }
919211
@Override
	public long skip(long n) throws IOException
    {
        if (n<=0)
            return 0;
        
        // How much can we skip ?
        long skippable = size - pos;
        if (skippable <= 0)
            return super.skip(n);
        
        long skipped = (skippable >= n) ? n : skippable;
        pos += skipped;
        return skipped;
    }
701282
public char next() throws JSONException {
        int c;
        if (this.usePrevious) {
            this.usePrevious = false;
            c = this.previous;
        } else {
            try {
                c = this.reader.read();
            } catch (IOException exception) {
                throw new JSONException(exception);
            }
        }
        if (c <= 0) { // End of stream
            this.eof = true;
            return 0;
        }
        this.incrementIndexes(c);
        this.previous = (char) c;
        return this.previous;
    }
232104
def read(self, n=None):
        
        response = b""
        while n is None or n > 0:
            c = self.stream.read(1)
            if c == b"":
                break
            elif c == b"<":
                c += self.stream.read(1)
                if c == b"<?":
                    while True:
                        q = self.stream.read(1)
                        if q == b">":
                            break
                else:
                    response += c
                    if n is not None:
                        n -= len(c)
            else:
                response += c
                if n is not None:
                    n -= 1
        return response
150166
private int next() throws IOException {
        int c = get();
        if (c == '/') {
            switch (peek()) {
                case '/':
                    for (; ; ) {
                        c = get();
                        if (c <= '\n') {
                            break;
                        }
                    }
                    break;
                case '*':
                    get();
                    while (c != ' ') {
                        switch (get()) {
                            case '*':
                                if (peek() == '/') {
                                    get();
                                    c = ' ';
                                }
                                break;
                            case EOF:
                                error("Unterminated comment.");
                        }
                    }
                    break;
            }
        }
        theY = theX;
        theX = c;
        return c;
    }
940227
public int readInt()
    throws IOException
  {
    if (_readOffset + 4 < _readLength) {
      return (((_readBuffer[_readOffset++] & 0xff) << 24)
              + ((_readBuffer[_readOffset++] & 0xff) << 16)
              + ((_readBuffer[_readOffset++] & 0xff) << 8)
              + ((_readBuffer[_readOffset++] & 0xff)));
    }
    else {
      return ((read() << 24)
              + (read() << 16)
              + (read() << 8)
              + (read()));
    }
  }
690494
public int read()
        throws IOException
    {
        int b=-1;
        if (_chunkSize<=0 && getChunkSize()<=0)
            return -1;
        b=_in.read();
        if (b<0)
        {
            _chunkSize=-1;
            throw new IOException(__UNEXPECTED_EOF);
        }
        _chunkSize--;
        return b;
    }
1044597
public int nextToken() throws IOException
   {
      int c;
      int nextc = -1;
      boolean quoted = false;
      int result = m_next;
      if (m_next != 0)
      {
         m_next = 0;
      }

      m_buffer.setLength(0);

      while (result == 0)
      {
         if (nextc != -1)
         {
            c = nextc;
            nextc = -1;
         }
         else
         {
            c = read();
         }

         switch (c)
         {
            case TT_EOF:
            {
               if (m_buffer.length() != 0)
               {
                  result = TT_WORD;
                  m_next = TT_EOF;
               }
               else
               {
                  result = TT_EOF;
               }
               break;
            }

            case TT_EOL:
            {
               int length = m_buffer.length();

               if (length != 0 && m_buffer.charAt(length - 1) == '\r')
               {
                  --length;
                  m_buffer.setLength(length);
               }

               if (length == 0)
               {
                  result = TT_EOL;
               }
               else
               {
                  result = TT_WORD;
                  m_next = TT_EOL;
               }

               break;
            }

            default:
            {
               if (c == m_quote)
               {
                  if (quoted == false && startQuotedIsValid(m_buffer))
                  {
                     quoted = true;
                  }
                  else
                  {
                     if (quoted == false)
                     {
                        m_buffer.append((char) c);
                     }
                     else
                     {
                        nextc = read();
                        if (nextc == m_quote)
                        {
                           m_buffer.append((char) c);
                           nextc = -1;
                        }
                        else
                        {
                           quoted = false;
                        }
                     }
                  }
               }
               else
               {
                  if (c == m_delimiter && quoted == false)
                  {
                     result = TT_WORD;
                  }
                  else
                  {
                     m_buffer.append((char) c);
                  }
               }
            }
         }
      }

      m_type = result;

      return (result);
   }