File tree 2 files changed +1
-15
lines changed
io/src/main/java/software/amazon/smithy/java/io
mcp/mcp-cli-api/src/main/java/software/amazon/smithy/java/mcp/cli
2 files changed +1
-15
lines changed Original file line number Diff line number Diff line change 7
7
8
8
import java .io .InputStream ;
9
9
import java .nio .ByteBuffer ;
10
- import java .nio .charset .Charset ;
11
- import java .nio .charset .StandardCharsets ;
12
10
import java .util .Base64 ;
13
11
14
12
public final class ByteBufferUtils {
@@ -35,15 +33,6 @@ public static byte[] getBytes(ByteBuffer buffer) {
35
33
return bytes ;
36
34
}
37
35
38
- public static String asString (ByteBuffer buffer ) {
39
- return asString (buffer , StandardCharsets .UTF_8 );
40
- }
41
-
42
- public static String asString (ByteBuffer buffer , Charset charset ) {
43
- byte [] bytes = getBytes (buffer );
44
- return new String (bytes , charset );
45
- }
46
-
47
36
public static InputStream byteBufferInputStream (ByteBuffer buffer ) {
48
37
return new ByteBufferBackedInputStream (buffer );
49
38
}
Original file line number Diff line number Diff line change @@ -99,10 +99,7 @@ static Path getBundleFileLocation(String bundleName) {
99
99
* @throws IOException If there's an error writing to the file
100
100
*/
101
101
public static void updateConfig (Config config ) throws IOException {
102
- var file = CONFIG_PATH .toFile ();
103
- try (var writer = new FileWriter (file , StandardCharsets .UTF_8 )) {
104
- writer .write (ByteBufferUtils .asString (JSON_CODEC .serialize (config )));
105
- }
102
+ Files .write (CONFIG_PATH , toJson (config ), StandardOpenOption .CREATE_NEW );
106
103
}
107
104
108
105
/**
You can’t perform that action at this time.
0 commit comments