mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8234147: Avoid looking up standard charsets in core libraries
Reviewed-by: alanb
This commit is contained in:
parent
4e64af81a2
commit
cd589d8469
36 changed files with 200 additions and 237 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2009, 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
|
||||
|
@ -33,7 +33,7 @@ import java.nio.charset.CharsetEncoder;
|
|||
import java.nio.charset.CharacterCodingException;
|
||||
import java.nio.charset.CodingErrorAction;
|
||||
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import sun.nio.cs.UTF_8;
|
||||
|
||||
/**
|
||||
* Utility class for zipfile name and comment decoding and encoding
|
||||
|
@ -67,10 +67,10 @@ class ZipCoder {
|
|||
}
|
||||
|
||||
// UTF_8.ArrayEn/Decoder is stateless, so make it singleton.
|
||||
private static ZipCoder utf8 = new UTF8(UTF_8);
|
||||
private static ZipCoder utf8 = new UTF8(UTF_8.INSTANCE);
|
||||
|
||||
public static ZipCoder get(Charset charset) {
|
||||
if (charset == UTF_8)
|
||||
if (charset == UTF_8.INSTANCE)
|
||||
return utf8;
|
||||
return new ZipCoder(charset);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue