< prev index next >
src/java.base/share/classes/java/util/zip/ZipFile.java
Print this page
8203328: Rename EFS in java.util.zip internals to something meaningful
Reviewed-by: sherman
@@ -375,11 +375,11 @@
Set<InputStream> istreams = res.istreams;
synchronized (this) {
ensureOpen();
if (Objects.equals(lastEntryName, entry.name)) {
pos = lastEntryPos;
- } else if (!zc.isUTF8() && (entry.flag & EFS) != 0) {
+ } else if (!zc.isUTF8() && (entry.flag & USE_UTF8) != 0) {
pos = zsrc.getEntryPos(zc.getBytesUTF8(entry.name), false);
} else {
pos = zsrc.getEntryPos(zc.getBytes(entry.name), false);
}
if (pos == -1) {
@@ -603,11 +603,11 @@
}
private String getEntryName(int pos) {
byte[] cen = res.zsrc.cen;
int nlen = CENNAM(cen, pos);
- if (!zc.isUTF8() && (CENFLG(cen, pos) & EFS) != 0) {
+ if (!zc.isUTF8() && (CENFLG(cen, pos) & USE_UTF8) != 0) {
return zc.toStringUTF8(cen, pos + CENHDR, nlen);
} else {
return zc.toString(cen, pos + CENHDR, nlen);
}
}
@@ -663,11 +663,11 @@
if (name == null || bname.length != nlen) {
// to use the entry name stored in cen, if the passed in name is
// (1) null, invoked from iterator, or
// (2) not equal to the name stored, a slash is appended during
// getEntryPos() search.
- if (!zc.isUTF8() && (flag & EFS) != 0) {
+ if (!zc.isUTF8() && (flag & USE_UTF8) != 0) {
name = zc.toStringUTF8(cen, pos + CENHDR, nlen);
} else {
name = zc.toString(cen, pos + CENHDR, nlen);
}
}
@@ -682,11 +682,11 @@
int start = pos + CENHDR + nlen;
e.setExtra0(Arrays.copyOfRange(cen, start, start + elen), true);
}
if (clen != 0) {
int start = pos + CENHDR + nlen + elen;
- if (!zc.isUTF8() && (flag & EFS) != 0) {
+ if (!zc.isUTF8() && (flag & USE_UTF8) != 0) {
e.comment = zc.toStringUTF8(cen, start, clen);
} else {
e.comment = zc.toString(cen, start, clen);
}
}
@@ -982,11 +982,12 @@
}
off += sz;
}
}
- /* The Zip file spec explicitly allows the LOC extra data size to
+ /*
+ * The Zip file spec explicitly allows the LOC extra data size to
* be different from the CEN extra data size. Since we cannot trust
* the CEN extra data size, we need to read the LOC to determine
* the entry data offset.
*/
private long initDataOffset() throws IOException {
@@ -1287,11 +1288,11 @@
private static final int BUF_SIZE = 8192;
private final int readFullyAt(byte[] buf, int off, int len, long pos)
throws IOException
{
- synchronized(zfile) {
+ synchronized (zfile) {
zfile.seek(pos);
int N = len;
while (N > 0) {
int n = Math.min(BUF_SIZE, N);
zfile.readFully(buf, off, n);
@@ -1303,11 +1304,11 @@
}
private final int readAt(byte[] buf, int off, int len, long pos)
throws IOException
{
- synchronized(zfile) {
+ synchronized (zfile) {
zfile.seek(pos);
return zfile.read(buf, off, len);
}
}
@@ -1542,11 +1543,11 @@
* This while loop is an optimization where a double lookup
* for name and name+/ is being performed. The name char
* array has enough room at the end to try again with a
* slash appended if the first table lookup does not succeed.
*/
- while(true) {
+ while (true) {
/*
* Search down the target hash chain for a entry whose
* 32 bit hash matches the hashed name.
*/
while (idx != ZIP_ENDCHAIN) {
< prev index next >