/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
// Instance variables.
/* if expected != -1, after we've read >= expected, we're "closed" and return -1
* from subsequest read() 's
*/
protected boolean closed = false;
protected long expected;
{
super(is);
}
}
if (n == -1) {
/*
* don't close automatically when mark is set and is valid;
* cannot reset() after close()
*/
if (!isMarked()) {
close();
}
return;
}
count += n;
/**
* If read beyond the markLimit, invalidate the mark
*/
markLimit = -1;
}
if (isMarked()) {
return;
}
// if expected length is known, we could determine if
// read overrun.
if (expected > 0) {
close();
}
}
}
/**
* Returns true if the mark is valid, false otherwise
*/
private boolean isMarked() {
if (markLimit < 0) {
return false;
}
// mark is set, but is not valid anymore
return false;
}
// mark still holds
return true;
}
if (closed) {
return -1;
}
if (c != -1) {
justRead(1);
} else {
justRead(c);
}
return c;
}
if (closed) {
return -1;
}
justRead(n);
return n;
}
// REMIND: what does skip do on EOF????
if (closed) {
return 0;
}
if (in instanceof ChunkedInputStream) {
}
else {
// just skip min(n, num_bytes_left)
}
justRead(n);
return n;
}
if (closed) {
return;
}
pi.finishTracking();
closed = true;
}
}
if (closed) {
return;
}
/*
* mark the count to restore upon reset
*/
markedCount = count;
}
if (closed) {
return;
}
if (!isMarked()) {
throw new IOException ("Resetting to an invalid mark");
}
count = markedCount;
super.reset();
}
public boolean markSupported() {
if (closed) {
return false;
}
return super.markSupported();
}
try {
close();
}
finally {
// Call super class
super.finalize();
}
}
}