Skip to content

Commit c52b4bb

Browse files
committed
Use Java's base64 encoder
1 parent b9f9646 commit c52b4bb

2 files changed

Lines changed: 6 additions & 7 deletions

File tree

src/main/java/com/comphenix/protocol/wrappers/nbt/io/NbtTextSerializer.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
import java.io.DataInputStream;
66
import java.io.DataOutputStream;
77
import java.io.IOException;
8-
9-
import org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder;
8+
import java.util.Base64;
109

1110
import com.comphenix.protocol.wrappers.nbt.NbtBase;
1211
import com.comphenix.protocol.wrappers.nbt.NbtCompound;
@@ -23,7 +22,7 @@ public class NbtTextSerializer {
2322
* A default instance of this serializer.
2423
*/
2524
public static final NbtTextSerializer DEFAULT = new NbtTextSerializer();
26-
25+
2726
private NbtBinarySerializer binarySerializer;
2827

2928
public NbtTextSerializer() {
@@ -59,7 +58,7 @@ public <TType> String serialize(NbtBase<TType> value) {
5958
binarySerializer.serialize(value, dataOutput);
6059

6160
// Serialize that array
62-
return Base64Coder.encodeLines(outputStream.toByteArray());
61+
return Base64.getEncoder().encodeToString(outputStream.toByteArray());
6362
}
6463

6564
/**
@@ -70,7 +69,7 @@ public <TType> String serialize(NbtBase<TType> value) {
7069
* @throws IOException If we are unable to parse the input.
7170
*/
7271
public <TType> NbtWrapper<TType> deserialize(String input) throws IOException {
73-
ByteArrayInputStream inputStream = new ByteArrayInputStream(Base64Coder.decodeLines(input));
72+
ByteArrayInputStream inputStream = new ByteArrayInputStream(Base64.getDecoder().decode(input));
7473

7574
return binarySerializer.deserialize(new DataInputStream(inputStream));
7675
}

src/test/java/com/comphenix/protocol/wrappers/WrappedServerPingTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.comphenix.protocol.wrappers;
22

33
import java.io.IOException;
4+
import java.util.Base64;
45
import java.util.List;
56
import java.util.Optional;
67
import java.util.UUID;
@@ -20,7 +21,6 @@
2021
import org.junit.jupiter.api.BeforeAll;
2122
import org.junit.jupiter.api.Disabled;
2223
import org.junit.jupiter.api.Test;
23-
import org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder;
2424

2525
import static org.junit.jupiter.api.Assertions.*;
2626

@@ -79,7 +79,7 @@ public void fullTest() throws IOException {
7979

8080
assertArrayEquals(original, roundTrip.getFavicon().getData());
8181

82-
CompressedImage copy = CompressedImage.fromBase64Png(Base64Coder.encodeLines(tux.getData()));
82+
CompressedImage copy = CompressedImage.fromBase64Png(Base64.getEncoder().encodeToString(tux.getData()));
8383
assertArrayEquals(copy.getData(), roundTrip.getFavicon().getData());
8484
}
8585

0 commit comments

Comments
 (0)