Examples of ByteString


Examples of net.hydromatic.avatica.ByteString

    case CHAR:
      return new NlsString(Spaces.of(type.getPrecision()), null, null);
    case VARCHAR:
      return new NlsString("", null, null);
    case BINARY:
      return new ByteString(new byte[type.getPrecision()]);
    case VARBINARY:
      return ByteString.EMPTY;
    case TINYINT:
    case SMALLINT:
    case INTEGER:
View Full Code Here

Examples of net.hydromatic.avatica.ByteString

   * length, */
  private static ByteString padRight(ByteString s, int length) {
    if (s.length() >= length) {
      return s;
    }
    return new ByteString(Arrays.copyOf(s.getBytes(), length));
  }
View Full Code Here

Examples of net.hydromatic.avatica.ByteString

    assertEquals(-13000, SqlFunctions.round(-12845, 1000));
  }

  @Test public void testByteString() {
    final byte[] bytes = {(byte) 0xAB, (byte) 0xFF};
    final ByteString byteString = new ByteString(bytes);
    assertEquals(2, byteString.length());
    assertEquals("abff", byteString.toString());
    assertEquals("abff", byteString.toString(16));
    assertEquals("1010101111111111", byteString.toString(2));

    final ByteString emptyByteString = new ByteString(new byte[0]);
    assertEquals(0, emptyByteString.length());
    assertEquals("", emptyByteString.toString());
    assertEquals("", emptyByteString.toString(16));
    assertEquals("", emptyByteString.toString(2));

    assertEquals(emptyByteString, ByteString.EMPTY);

    assertEquals("ff", byteString.substring(1, 2).toString());
    assertEquals("abff", byteString.substring(0, 2).toString());
    assertEquals("", byteString.substring(2, 2).toString());

    // Add empty string, get original string back
    assertSame(byteString.concat(emptyByteString), byteString);
    final ByteString byteString1 = new ByteString(new byte[]{(byte) 12});
    assertEquals("abff0c", byteString.concat(byteString1).toString());

    final byte[] bytes3 = {(byte) 0xFF};
    final ByteString byteString3 = new ByteString(bytes3);

    assertEquals(0, byteString.indexOf(emptyByteString));
    assertEquals(-1, byteString.indexOf(byteString1));
    assertEquals(1, byteString.indexOf(byteString3));
    assertEquals(-1, byteString3.indexOf(byteString));
  }
View Full Code Here

Examples of org.apache.yoko.rmi.util.ByteString

        // debug
        logger.finer("idToClass " + repid);

        if (repid.startsWith("IDL:")) {

            ByteString id = new ByteString(repid);

            try {
                int end = id.lastIndexOf(':');
                ByteString s = end < 0 ? id.substring(4) : id.substring(4, end);

                ByteBuffer bb = new ByteBuffer();

                //
                // reverse order of dot-separated name components up
                // till the first slash.
                //
                int firstSlash = s.indexOf('/');
                if (firstSlash > 0) {
                    ByteString prefix = s.substring(0, firstSlash);
                    ByteString[] elems = prefix.split('.');

                    for (int i = elems.length - 1; i >= 0; i--) {
                        bb.append(fixName(elems[i]));
                        bb.append('.');
                    }
View Full Code Here

Examples of org.apache.yoko.rmi.util.ByteString

        return null;
    }

    static String fixName(String name) {
        return (new ByteString(name)).toString();
    }
View Full Code Here

Examples of org.apache.yoko.rmi.util.ByteString

            buf.append('_');
            buf.append(name);
            return buf.toByteString();
        }

        ByteString result = name;
        ByteString current = name;

        boolean match = true;
        while (match) {

            int len = current.length();
            match = false;

            for (int i = 0; i < reservedPostfixes.length; i++) {
                if (current.endsWith(reservedPostfixes[i])) {
                    ByteBuffer buf = new ByteBuffer();
                    buf.append('_');
                    buf.append(result);
                    result = buf.toByteString();

                    int resultLen = reservedPostfixes[i].length();
                    if (len > resultLen)
                        current = current.substring(0, len - resultLen);
                    else
                        current = new ByteString("");

                    match = true;
                    break;
                }
            }
View Full Code Here

Examples of org.hyperdex.client.ByteString

        expected3.put("v", "xxx");
        get3.entrySet().containsAll(expected3.entrySet());
        expected3.entrySet().containsAll(get3.entrySet());
        Map<String, Object> attrs4 = new HashMap<String, Object>();
        byte[] bytes5 = {(byte) 0xde, (byte) 0xad, (byte) 0xbe, (byte) 0xef};
        attrs4.put("v", new ByteString(bytes5));
        Object obj4 = c.put("kv", "k", attrs4);
        assert(obj4 != null);
        Boolean bool4 = (Boolean)obj4;
        assert(bool4 == true);
        Map<String, Object> get6 = c.get("kv", "k");
        assert(get6 != null);
        Map<String, Object> expected6 = new HashMap<String, Object>();
        byte[] bytes7 = {(byte) 0xde, (byte) 0xad, (byte) 0xbe, (byte) 0xef};
        expected6.put("v", new ByteString(bytes7));
        get6.entrySet().containsAll(expected6.entrySet());
        expected6.entrySet().containsAll(get6.entrySet());
    }
View Full Code Here

Examples of org.nasutekds.server.types.ByteString

    LDAPMessage message =
        org.nasutekds.server.protocols.ldap.LDAPReader.readMessage(asn1Reader);

    if(debugInputStream.isRecordingEnabled())
    {
      ByteString bytesRead = debugInputStream.getRecordedBytes();
      debugInputStream.clearRecordedBytes();

      StringBuilder builder = new StringBuilder();
      builder.append("bytes read from wire(len=");
      builder.append(bytesRead.length());
      builder.append("):");
      builder.append(ServerConstants.EOL);
      bytesRead.toHexPlusAscii(builder, 4);

      TRACER.debugProtocolElement(DebugLogLevel.VERBOSE, builder.toString());
      TRACER.debugProtocolElement(DebugLogLevel.VERBOSE, message.toString());
    }
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.