src/share/classes/java/util/zip/ZipCoder.java

Print this page
rev 4099 : 7041612: Rename StandardCharset to StandardCharsets
Reviewed-by: alanb, mr, darcy

*** 26,36 **** package java.util.zip; import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.Charset; ! import java.nio.charset.StandardCharset; import java.nio.charset.CharsetDecoder; import java.nio.charset.CharsetEncoder; import java.nio.charset.CoderResult; import java.nio.charset.CodingErrorAction; import java.util.Arrays; --- 26,36 ---- package java.util.zip; import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.Charset; ! import java.nio.charset.StandardCharsets; import java.nio.charset.CharsetDecoder; import java.nio.charset.CharsetEncoder; import java.nio.charset.CoderResult; import java.nio.charset.CodingErrorAction; import java.util.Arrays;
*** 105,124 **** // assume invoked only if "this" is not utf8 byte[] getBytesUTF8(String s) { if (isUTF8) return getBytes(s); if (utf8 == null) ! utf8 = new ZipCoder(StandardCharset.UTF_8); return utf8.getBytes(s); } String toStringUTF8(byte[] ba, int len) { if (isUTF8) return toString(ba, len); if (utf8 == null) ! utf8 = new ZipCoder(StandardCharset.UTF_8); return utf8.toString(ba, len); } boolean isUTF8() { return isUTF8; --- 105,124 ---- // assume invoked only if "this" is not utf8 byte[] getBytesUTF8(String s) { if (isUTF8) return getBytes(s); if (utf8 == null) ! utf8 = new ZipCoder(StandardCharsets.UTF_8); return utf8.getBytes(s); } String toStringUTF8(byte[] ba, int len) { if (isUTF8) return toString(ba, len); if (utf8 == null) ! utf8 = new ZipCoder(StandardCharsets.UTF_8); return utf8.toString(ba, len); } boolean isUTF8() { return isUTF8;
*** 130,140 **** private boolean isUTF8; private ZipCoder utf8; private ZipCoder(Charset cs) { this.cs = cs; ! this.isUTF8 = cs.name().equals(StandardCharset.UTF_8.name()); } static ZipCoder get(Charset charset) { return new ZipCoder(charset); } --- 130,140 ---- private boolean isUTF8; private ZipCoder utf8; private ZipCoder(Charset cs) { this.cs = cs; ! this.isUTF8 = cs.name().equals(StandardCharsets.UTF_8.name()); } static ZipCoder get(Charset charset) { return new ZipCoder(charset); }