< prev index next >

src/java.base/share/classes/sun/net/www/MeteredStream.java

Print this page




 109            return false;
 110         }
 111 
 112         // mark still holds
 113         return true;
 114     }
 115 
 116     public synchronized int read() throws java.io.IOException {
 117         if (closed) {
 118             return -1;
 119         }
 120         int c = in.read();
 121         if (c != -1) {
 122             justRead(1);
 123         } else {
 124             justRead(c);
 125         }
 126         return c;
 127     }
 128 
 129     public synchronized int read(byte b[], int off, int len)
 130                 throws java.io.IOException {
 131         if (closed) {
 132             return -1;
 133         }
 134         int n = in.read(b, off, len);
 135         justRead(n);
 136         return n;
 137     }
 138 
 139     public synchronized long skip(long n) throws IOException {
 140 
 141         // REMIND: what does skip do on EOF????
 142         if (closed) {
 143             return 0;
 144         }
 145 
 146         if (in instanceof ChunkedInputStream) {
 147             n = in.skip(n);
 148         }
 149         else {




 109            return false;
 110         }
 111 
 112         // mark still holds
 113         return true;
 114     }
 115 
 116     public synchronized int read() throws java.io.IOException {
 117         if (closed) {
 118             return -1;
 119         }
 120         int c = in.read();
 121         if (c != -1) {
 122             justRead(1);
 123         } else {
 124             justRead(c);
 125         }
 126         return c;
 127     }
 128 
 129     public synchronized int read(byte[] b, int off, int len)
 130                 throws java.io.IOException {
 131         if (closed) {
 132             return -1;
 133         }
 134         int n = in.read(b, off, len);
 135         justRead(n);
 136         return n;
 137     }
 138 
 139     public synchronized long skip(long n) throws IOException {
 140 
 141         // REMIND: what does skip do on EOF????
 142         if (closed) {
 143             return 0;
 144         }
 145 
 146         if (in instanceof ChunkedInputStream) {
 147             n = in.skip(n);
 148         }
 149         else {


< prev index next >