Diff of /tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/io/XByteBuffer.java
Parent Directory
| Revision Log
| Patch
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/io/XByteBuffer.java 2006/02/28 22:25:36 381797
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/io/XByteBuffer.java 2006/02/28 22:26:50 381798
@@ -331,6 +331,22 @@ public class XByteBuffer
( ( ( (long) b[off+0]) & 0xFF) << 56);
}
+
+ /**
+ * Converts an integer to four bytes
+ * @param n - the integer
+ * @return - four bytes in an array
+ */
+ public static byte[] toBytes(boolean bool) {
+ byte[] b = new byte[] {(byte)(bool?1:0)};
+ return b;
+ }
+
+ public static boolean toBoolean(byte[] b, int offset) {
+ return b[offset] != 0;
+ }
+
+
/**
* Converts an integer to four bytes
* @param n - the integer