jdk/src/share/classes/java/io/PushbackInputStream.java
changeset 7280 81f10887bf74
parent 5506 202f599c92aa
child 7668 d4a77089c587
equal deleted inserted replaced
7279:32ac37aa9367 7280:81f10887bf74
   271      * @see        java.io.FilterInputStream#in
   271      * @see        java.io.FilterInputStream#in
   272      * @see        java.io.InputStream#available()
   272      * @see        java.io.InputStream#available()
   273      */
   273      */
   274     public int available() throws IOException {
   274     public int available() throws IOException {
   275         ensureOpen();
   275         ensureOpen();
   276         return (buf.length - pos) + super.available();
   276         int n = buf.length - pos;
       
   277         int avail = super.available();
       
   278         return n > (Integer.MAX_VALUE - avail)
       
   279                     ? Integer.MAX_VALUE
       
   280                     : n + avail;
   277     }
   281     }
   278 
   282 
   279     /**
   283     /**
   280      * Skips over and discards <code>n</code> bytes of data from this
   284      * Skips over and discards <code>n</code> bytes of data from this
   281      * input stream. The <code>skip</code> method may, for a variety of
   285      * input stream. The <code>skip</code> method may, for a variety of