/[classpath]/classpath/java/io/BufferedInputStream.java
ViewVC logotype

Diff of /classpath/java/io/BufferedInputStream.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.12 by jfrijters, Sat Jul 10 08:03:01 2004 UTC revision 1.12.2.1 by gnu_andrew, Sun Jan 16 15:15:11 2005 UTC
# Line 261  public class BufferedInputStream extends Line 261  public class BufferedInputStream extends
261      if (off < 0 || len < 0 || b.length - off < len)      if (off < 0 || len < 0 || b.length - off < len)
262        throw new IndexOutOfBoundsException();        throw new IndexOutOfBoundsException();
263    
264        if (len == 0)
265          return 0;
266    
267      if (pos >= count && !refill())      if (pos >= count && !refill())
268        return -1;                // No bytes were read before EOF.        return -1;                // No bytes were read before EOF.
269    
# Line 318  public class BufferedInputStream extends Line 321  public class BufferedInputStream extends
321    public synchronized long skip(long n) throws IOException    public synchronized long skip(long n) throws IOException
322    {    {
323      if (buf == null)      if (buf == null)
324          throw new IOException("Stream closed.");        throw new IOException("Stream closed.");
325    
326      final long origN = n;      final long origN = n;
327    
328      while (n > 0L)      while (n > 0L)
329        {        {
330          if (pos >= count && !refill())          if (pos >= count && !refill())
331            if (n < origN)            break;
             break;  
           else  
             return -1;  // No bytes were read before EOF.  
332    
333          int numread = (int) Math.min((long) (count - pos), n);          int numread = (int) Math.min((long) (count - pos), n);
334          pos += numread;          pos += numread;
# Line 347  public class BufferedInputStream extends Line 347  public class BufferedInputStream extends
347    private boolean refill() throws IOException    private boolean refill() throws IOException
348    {    {
349      if (buf == null)      if (buf == null)
350          throw new IOException("Stream closed.");        throw new IOException("Stream closed.");
351    
352      if (markpos == -1 || count - markpos >= marklimit)      if (markpos == -1 || count - markpos >= marklimit)
353        {        {
# Line 371  public class BufferedInputStream extends Line 371  public class BufferedInputStream extends
371      int numread = super.read(buf, count, bufferSize);      int numread = super.read(buf, count, bufferSize);
372    
373      if (numread <= 0)   // EOF      if (numread <= 0)   // EOF
374          return false;        return false;
375    
376      count += numread;      count += numread;
377      return true;      return true;

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.12.2.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26