< prev index next >

src/java.base/share/classes/java/util/zip/ZipInputStream.java

Print this page
8203328: Rename EFS in java.util.zip internals to something meaningful
Reviewed-by: sherman

*** 96,106 **** * @since 1.7 */ public ZipInputStream(InputStream in, Charset charset) { super(new PushbackInputStream(in, 512), new Inflater(true), 512); usesDefaultInflater = true; ! if(in == null) { throw new NullPointerException("in is null"); } if (charset == null) throw new NullPointerException("charset is null"); this.zc = ZipCoder.get(charset); --- 96,106 ---- * @since 1.7 */ public ZipInputStream(InputStream in, Charset charset) { super(new PushbackInputStream(in, 512), new Inflater(true), 512); usesDefaultInflater = true; ! if (in == null) { throw new NullPointerException("in is null"); } if (charset == null) throw new NullPointerException("charset is null"); this.zc = ZipCoder.get(charset);
*** 281,291 **** return null; } if (get32(tmpbuf, 0) != LOCSIG) { return null; } ! // get flag first, we need check EFS. flag = get16(tmpbuf, LOCFLG); // get the entry name and create the ZipEntry first int len = get16(tmpbuf, LOCNAM); int blen = b.length; if (len > blen) { --- 281,291 ---- return null; } if (get32(tmpbuf, 0) != LOCSIG) { return null; } ! // get flag first, we need check USE_UTF8. flag = get16(tmpbuf, LOCFLG); // get the entry name and create the ZipEntry first int len = get16(tmpbuf, LOCNAM); int blen = b.length; if (len > blen) {
*** 293,304 **** blen = blen * 2; } while (len > blen); b = new byte[blen]; } readFully(b, 0, len); ! // Force to use UTF-8 if the EFS bit is ON, even the cs is NOT UTF-8 ! ZipEntry e = createZipEntry(((flag & EFS) != 0) ? zc.toStringUTF8(b, len) : zc.toString(b, len)); // now get the remaining fields for the entry if ((flag & 1) == 1) { throw new ZipException("encrypted ZIP entry not supported"); --- 293,304 ---- blen = blen * 2; } while (len > blen); b = new byte[blen]; } readFully(b, 0, len); ! // Force to use UTF-8 if the USE_UTF8 bit is ON ! ZipEntry e = createZipEntry(((flag & USE_UTF8) != 0) ? zc.toStringUTF8(b, len) : zc.toString(b, len)); // now get the remaining fields for the entry if ((flag & 1) == 1) { throw new ZipException("encrypted ZIP entry not supported");
< prev index next >