Added Change utility class for representing change events + Moved Match class to org.onlab.util
Change-Id: I08e8cd8dd92983bd2764e83016b1abc0bf29388f
diff --git a/utils/misc/src/main/java/org/onlab/util/Tools.java b/utils/misc/src/main/java/org/onlab/util/Tools.java
index ffefbfd..296e14b 100644
--- a/utils/misc/src/main/java/org/onlab/util/Tools.java
+++ b/utils/misc/src/main/java/org/onlab/util/Tools.java
@@ -54,6 +54,7 @@
import org.slf4j.Logger;
+import com.google.common.base.Charsets;
import com.google.common.base.Strings;
import com.google.common.primitives.UnsignedLongs;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
@@ -210,6 +211,20 @@
}
/**
+ * Returns the UTF-8 encoded byte[] representation of a String.
+ */
+ public static byte[] getBytesUtf8(String input) {
+ return input.getBytes(Charsets.UTF_8);
+ }
+
+ /**
+ * Returns the String representation of UTF-8 encoded byte[].
+ */
+ public static String toStringUtf8(byte[] input) {
+ return new String(input, Charsets.UTF_8);
+ }
+
+ /**
* Returns a copy of the input byte array.
*
* @param original input