File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
network/common/src/main/java/org/apache/spark/network/util Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 2828import java .io .ObjectOutputStream ;
2929
3030import com .google .common .io .Closeables ;
31+ import com .google .common .base .Charsets ;
3132import org .slf4j .Logger ;
3233import org .slf4j .LoggerFactory ;
3334
3435public class JavaUtils {
3536 private static final Logger logger = LoggerFactory .getLogger (JavaUtils .class );
36- private static final Charset UTF8_CHARSET = Charset .forName ("UTF-8" );
3737
3838 /** Closes the given object, ignoring IOExceptions. */
3939 public static void closeQuietly (Closeable closeable ) {
@@ -83,14 +83,14 @@ public static int nonNegativeHash(Object obj) {
8383 * converted back to the same string through {@link #bytesToString(ByteBuffer)}.
8484 */
8585 public static ByteBuffer stringToBytes (String s ) {
86- return ByteBuffer .wrap (s .getBytes (UTF8_CHARSET ));
86+ return ByteBuffer .wrap (s .getBytes (Charsets . UTF_8 ));
8787 }
8888
8989 /**
9090 * Convert the given byte buffer to a string. The resulting string can be
9191 * converted back to the same byte buffer through {@link #stringToBytes(String)}.
9292 */
9393 public static String bytesToString (ByteBuffer b ) {
94- return new String (b .array (), UTF8_CHARSET );
94+ return new String (b .array (), Charsets . UTF_8 );
9595 }
9696}
You can’t perform that action at this time.
0 commit comments