Package com.ning.tr13.impl.vint

Examples of com.ning.tr13.impl.vint.SimpleVIntTrieBuilder


    public void testSimpleUsingByteArray() throws Exception
    {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        new SimpleBytesTrieBuilder(new MapReader(TEST_ENTRIES)).buildAndWrite(out, false);
        byte[] raw = out.toByteArray();
        _testSimple(new ByteArrayBytesTrieLookup(raw));
    }
View Full Code Here


     * Method for constructing byte[] ("bytes") valued tries, using
     * raw byte array as is for lookup.
     */
    public static BytesTrieLookup constructByteArrayBytesTrie(byte[] raw)
    {
        return new ByteArrayBytesTrieLookup(raw);
    }
View Full Code Here

    {
        TrieHeader header = _readHeader(in, true);
        int len = (int) header.getPayloadLength();
        byte[] buffer = new byte[len];
        InputUtil.readFully(in, buffer, 0, len);
        return new ByteArrayBytesTrieLookup(buffer);
    }
View Full Code Here

        /* // uncomment for eyeballing if necessary:
for (int i = 0; i < raw.length; ++i) {
    System.out.println("#"+i+" -> 0x"+Integer.toHexString(0xFF & raw[i])+" / '"+((char) raw[i])+"'");
}
*/
        _testSimple(new ByteBufferBytesTrieLookup(ByteBuffer.wrap(raw), raw.length));
    }
View Full Code Here

     */
    public static BytesTrieLookup constructByteBufferBytesTrie(byte[] raw,
            ByteBufferAllocator a)
    {
      ByteBuffer bb = _arrayToBuffer(raw, a);
        return new ByteBufferBytesTrieLookup(bb, raw.length);
    }
View Full Code Here

                throw new IOException("Unexpected end-of-stream: still needed to read "+len+" bytes");
            }
            bb.put(buffer, 0, count);
            len -= count;
        }
        return new ByteBufferBytesTrieLookup(bb, len);
    }
View Full Code Here

    }

    public void testSimpleUsingByteBuffer() throws Exception
    {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        new SimpleBytesTrieBuilder(new MapReader(TEST_ENTRIES)).buildAndWrite(out, false);
        byte[] raw = out.toByteArray();
        /* // uncomment for eyeballing if necessary:
for (int i = 0; i < raw.length; ++i) {
    System.out.println("#"+i+" -> 0x"+Integer.toHexString(0xFF & raw[i])+" / '"+((char) raw[i])+"'");
}
View Full Code Here

    }

    public void testSimpleUsingByteArray() throws Exception
    {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        new SimpleBytesTrieBuilder(new MapReader(TEST_ENTRIES)).buildAndWrite(out, false);
        byte[] raw = out.toByteArray();
        _testSimple(new ByteArrayBytesTrieLookup(raw));
    }
View Full Code Here

    public void testSimpleUsingByteArray() throws Exception
    {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        new SimpleVIntTrieBuilder(new MapReader(TEST_ENTRIES)).buildAndWrite(out, false);
        byte[] raw = out.toByteArray();
        _testSimple(new ByteArrayVIntTrieLookup(raw));
    }
View Full Code Here

     * Method for constructing variable int (VInt) valued tries, using
     * raw byte array as is for lookup.
     */
    public static VIntTrieLookup constructByteArrayVIntTrie(byte[] raw)
    {
        return new ByteArrayVIntTrieLookup(raw);
    }
View Full Code Here

TOP

Related Classes of com.ning.tr13.impl.vint.SimpleVIntTrieBuilder

Copyright © 2018 www.massapicom. 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.