< prev index next >
src/java.base/share/classes/com/sun/java/util/jar/pack/PackageReader.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -73,10 +73,12 @@
* the maximum number of characters that future reads
* can consume from the underlying stream.
*/
static
class LimitedBuffer extends BufferedInputStream {
+ static final InputStream NULL_STREAM = InputStream.nullInputStream();
+
long served; // total number of charburgers served
int servedPos; // ...as of this value of super.pos
long limit; // current declared limit
long buffered;
public boolean atLimit() {
@@ -121,11 +123,11 @@
}
public long skip(long n) throws IOException {
throw new RuntimeException("no skipping");
}
LimitedBuffer(InputStream originalIn) {
- super(null, 1<<14);
+ super(NULL_STREAM, 1<<14);
servedPos = pos;
super.in = new FilterInputStream(originalIn) {
public int read() throws IOException {
if (buffered == limit)
return -1;
< prev index next >