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 28
28
import java .io .ObjectOutputStream ;
29
29
30
30
import com .google .common .io .Closeables ;
31
+ import com .google .common .base .Charsets ;
31
32
import org .slf4j .Logger ;
32
33
import org .slf4j .LoggerFactory ;
33
34
34
35
public class JavaUtils {
35
36
private static final Logger logger = LoggerFactory .getLogger (JavaUtils .class );
36
- private static final Charset UTF8_CHARSET = Charset .forName ("UTF-8" );
37
37
38
38
/** Closes the given object, ignoring IOExceptions. */
39
39
public static void closeQuietly (Closeable closeable ) {
@@ -83,14 +83,14 @@ public static int nonNegativeHash(Object obj) {
83
83
* converted back to the same string through {@link #bytesToString(ByteBuffer)}.
84
84
*/
85
85
public static ByteBuffer stringToBytes (String s ) {
86
- return ByteBuffer .wrap (s .getBytes (UTF8_CHARSET ));
86
+ return ByteBuffer .wrap (s .getBytes (Charsets . UTF_8 ));
87
87
}
88
88
89
89
/**
90
90
* Convert the given byte buffer to a string. The resulting string can be
91
91
* converted back to the same byte buffer through {@link #stringToBytes(String)}.
92
92
*/
93
93
public static String bytesToString (ByteBuffer b ) {
94
- return new String (b .array (), UTF8_CHARSET );
94
+ return new String (b .array (), Charsets . UTF_8 );
95
95
}
96
96
}
You can’t perform that action at this time.
0 commit comments