Beispiel #1
0
 /**
  * Get a byte array containing the encoded signature
  *
  * @return the byte array
  */
 byte[] asBytes() {
   try {
     ByteArrayOutputStream out = new ByteArrayOutputStream();
     Nat.write(_majorVersion, out);
     Nat.write(_minorVersion, out);
     _table.write(out);
     return out.toByteArray();
   } catch (IOException e) {
     throw new CtxException("Unexpected error converting signature to byte array", e);
   }
 }
Beispiel #2
0
 /**
  * Write entry back to a stream
  *
  * @param bos stream to write to
  * @throws IOException
  */
 public void write(ByteArrayOutputStream bos) throws IOException {
   Nat.write(TblTypeID.EXT_MOD_CLASS_REF_ID, bos);
   if (_symbolRef != -1) {
     Nat.write(Nat.size(_nameRef) + Nat.size(_symbolRef), bos);
     Nat.write(_nameRef, bos);
     Nat.write(_symbolRef, bos);
   } else {
     Nat.write(Nat.size(_nameRef), bos);
     Nat.write(_nameRef, bos);
   }
 }
Beispiel #3
0
 /**
  * Write the table as a byte stream
  *
  * @param out the stream to write to
  * @throws IOException
  */
 void write(ByteArrayOutputStream out) throws IOException {
   Nat.write(entries.size(), out);
   for (TableEntry e : entries) {
     e.write(out);
   }
 }
Beispiel #4
0
 private static void write(int nat, ByteArrayOutputStream out, int flag) {
   int b = nat & 0x7f;
   int h = nat >> 7;
   if (h != 0) write(h, out, 0x80);
   out.write(b | flag);
 }
Beispiel #5
0
 static void write(int nat, ByteArrayOutputStream out) {
   write(nat, out, 0);
 }
Beispiel #6
0
 /**
  * Write entry back to a stream
  *
  * @param bos stream to write to
  * @throws IOException
  */
 public void write(ByteArrayOutputStream bos) throws IOException {
   Nat.write(TblTypeID.TERM_NAME_ID, bos);
   byte[] bytes = _name.getBytes(StandardCharsets.UTF_8);
   Nat.write(bytes.length, bos);
   bos.write(bytes);
 }
Beispiel #7
0
 /**
  * Write entry back to a stream
  *
  * @param bos stream to write to
  * @throws IOException
  */
 public void write(ByteArrayOutputStream bos) throws IOException {
   Nat.write(type, bos);
   Nat.write(raw.length, bos);
   bos.write(raw);
 }