Exemple #1
0
 public static void testWriteByteBuffer() throws Exception {
   byte[] buf = new byte[1024], tmp;
   for (int i = 0; i < buf.length; i++) buf[i] = 0;
   ByteArrayOutputStream outstream = new ByteArrayOutputStream();
   DataOutputStream dos = new DataOutputStream(outstream);
   Util.writeByteBuffer(buf, dos);
   dos.close();
   tmp = outstream.toByteArray();
   ByteArrayInputStream instream = new ByteArrayInputStream(tmp);
   DataInputStream dis = new DataInputStream(instream);
   byte[] buf2 = Util.readByteBuffer(dis);
   assert buf2 != null;
   Assert.assertEquals(buf.length, buf2.length);
 }
Exemple #2
0
 public void writeTo(DataOutput out) throws Exception {
   if (log.isDebugEnabled()) {
     log.debug("X509Token writeTo()");
   }
   Util.writeByteBuffer(this.encryptedToken, out);
 }