Package org.nasutekds.server.types

Examples of org.nasutekds.server.types.ByteStringBuilder.toByteArray()


    ByteStringBuilder bsb = new ByteStringBuilder();
    bsb.append(ASN1Constants.UNIVERSAL_OCTET_STRING_TYPE);
    bsb.appendBERLength(b.length);
    bsb.append(b);

    assertEquals(getReader(bsb.toByteArray(), 0).readOctetString(),
        ByteString.wrap(b));
  }

  /**
   * Tests the <CODE>decodeAsOctetStringAsString</CODE> method that takes a
View Full Code Here


    ByteStringBuilder bsb = new ByteStringBuilder();
    bsb.append(ASN1Constants.UNIVERSAL_OCTET_STRING_TYPE);
    bsb.appendBERLength(b.length);
    bsb.append(b);

    assertEquals(getReader(bsb.toByteArray(), 0).readOctetStringAsString(),
        new String(b, "UTF-8"));
  }

  /**
   * Tests the <CODE>decodeAsOctetStringAsString</CODE> method that takes a
View Full Code Here

    bsb.append(ASN1Constants.UNIVERSAL_OCTET_STRING_TYPE);
    bsb.appendBERLength(b.length);
    bsb.append(b);

    assertEquals(
        getReader(bsb.toByteArray(), 0).readOctetStringAsString("UTF-8"),
        new String(b, "UTF-8"));
  }

  /**
   * Tests the <CODE>decodeAsOctetStringBuilder</CODE> method that takes a
View Full Code Here

    bsb.appendBERLength(encodedElements.length + 2);
    bsb.append(ASN1Constants.UNIVERSAL_OCTET_STRING_TYPE);
    bsb.appendBERLength(encodedElements.length);
    bsb.append(encodedElements);

    ASN1Reader reader = getReader(bsb.toByteArray(), 0);
    assertEquals(reader.peekLength(), encodedElements.length + 2);
    reader.readStartSequence();
    assertEquals(reader.peekType(), ASN1Constants.UNIVERSAL_OCTET_STRING_TYPE);
    assertEquals(reader.peekLength(), encodedElements.length);
    reader.readOctetString().equals(ByteString.wrap(encodedElements));
View Full Code Here

        {
          // DO SOMETHING
        }
      }
    }
    return byteBuilder.toByteArray();
  }

  // ============
  // Msg decoding
  // ============
View Full Code Here

      writer.writeEndSequence();

      if (protocolVersion > ProtocolVersion.REPLICATION_PROTOCOL_V1)
      {
        return byteBuilder.toByteArray();
      }
      else
      {
        byte[] temp = byteBuilder.toByteArray();
View Full Code Here

      {
        return byteBuilder.toByteArray();
      }
      else
      {
        byte[] temp = byteBuilder.toByteArray();

        byte[] senderBytes = String.valueOf(senderID).getBytes("UTF-8");
        byte[] destinationBytes = String.valueOf(destination).getBytes("UTF-8");

        int length = 1 1 + senderBytes.length +
View Full Code Here

      writer.writeStartSequence();
      for (String attrDef : eclIncludes)
        writer.writeOctetString(attrDef);
      writer.writeEndSequence();

      return byteBuilder.toByteArray();
    }
    catch (Exception e)
    {
      return null;
    }
View Full Code Here

       ASN1Writer writer = ASN1.getWriter(byteBuilder);
       for (Attribute a : attributes)
       {
         new LDAPAttribute(a).write(writer);
       }
       return byteBuilder.toByteArray();
     }
     catch (Exception e)
     {
       return null;
     }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.