From 2a7d8397e7a19b5724ed8f7945fada78d5ee4942 Mon Sep 17 00:00:00 2001 From: nathan Date: Tue, 1 Aug 2017 00:51:17 +0200 Subject: [PATCH] Removed ability to wrap a String --- src/dorkbox/util/bytes/ByteArrayWrapper.java | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/src/dorkbox/util/bytes/ByteArrayWrapper.java b/src/dorkbox/util/bytes/ByteArrayWrapper.java index b6525a3..e48e04b 100644 --- a/src/dorkbox/util/bytes/ByteArrayWrapper.java +++ b/src/dorkbox/util/bytes/ByteArrayWrapper.java @@ -15,16 +15,13 @@ */ package dorkbox.util.bytes; -import java.nio.charset.Charset; import java.util.Arrays; /** * Necessary to provide equals and hashcode methods on a byte arrays, if they are to be used as keys in a map/set/etc */ -public final +public class ByteArrayWrapper { - public static final Charset UTF_8 = Charset.forName("UTF-8"); - private byte[] data; private Integer hashCode; @@ -39,7 +36,7 @@ class ByteArrayWrapper { * @param copyBytes if TRUE, then the byteArray is copied. if FALSE, the byte array is used as-is. * Using FALSE IS DANGEROUS!!!! If the underlying byte array is modified, this changes as well. */ - private + public ByteArrayWrapper(byte[] data, boolean copyBytes) { if (data == null) { throw new NullPointerException(); @@ -81,19 +78,6 @@ class ByteArrayWrapper { return new ByteArrayWrapper(data, false); } - /** - * Gets the UTF8 bytes from the string, and wraps them in a ByteArrayWrapper. - */ - public static - ByteArrayWrapper wrap(String data) { - if (data == null) { - return null; - } - - byte[] bytes = data.getBytes(UTF_8); - return ByteArrayWrapper.wrap(bytes); - } - public byte[] getBytes() { return this.data;