src/share/classes/java/util/jar/Manifest.java

Print this page




 383                     n = avail;
 384                 }
 385                 int tpos = pos;
 386                 int maxpos = tpos + n;
 387                 while (tpos < maxpos && tbuf[tpos++] != '\n') ;
 388                 n = tpos - pos;
 389                 System.arraycopy(tbuf, pos, b, off, n);
 390                 off += n;
 391                 total += n;
 392                 pos = tpos;
 393                 if (tbuf[tpos-1] == '\n') {
 394                     break;
 395                 }
 396             }
 397             return total;
 398         }
 399 
 400         public byte peek() throws IOException {
 401             if (pos == count)
 402                 fill();


 403             return buf[pos];
 404         }
 405 
 406         public int readLine(byte[] b) throws IOException {
 407             return readLine(b, 0, b.length);
 408         }
 409 
 410         public long skip(long n) throws IOException {
 411             if (n <= 0) {
 412                 return 0;
 413             }
 414             long avail = count - pos;
 415             if (avail <= 0) {
 416                 return in.skip(n);
 417             }
 418             if (n > avail) {
 419                 n = avail;
 420             }
 421             pos += n;
 422             return n;




 383                     n = avail;
 384                 }
 385                 int tpos = pos;
 386                 int maxpos = tpos + n;
 387                 while (tpos < maxpos && tbuf[tpos++] != '\n') ;
 388                 n = tpos - pos;
 389                 System.arraycopy(tbuf, pos, b, off, n);
 390                 off += n;
 391                 total += n;
 392                 pos = tpos;
 393                 if (tbuf[tpos-1] == '\n') {
 394                     break;
 395                 }
 396             }
 397             return total;
 398         }
 399 
 400         public byte peek() throws IOException {
 401             if (pos == count)
 402                 fill();
 403             if (pos == count)
 404                 return -1; // nothing left in buffer
 405             return buf[pos];
 406         }
 407 
 408         public int readLine(byte[] b) throws IOException {
 409             return readLine(b, 0, b.length);
 410         }
 411 
 412         public long skip(long n) throws IOException {
 413             if (n <= 0) {
 414                 return 0;
 415             }
 416             long avail = count - pos;
 417             if (avail <= 0) {
 418                 return in.skip(n);
 419             }
 420             if (n > avail) {
 421                 n = avail;
 422             }
 423             pos += n;
 424             return n;