Examples of TrieHeader


Examples of com.ning.tr13.lookup.TrieHeader

        return trie;
    }

    public static VIntTrieLookup readByteArrayVIntTrie(InputStream in) throws IOException
    {
        TrieHeader header = _readHeader(in, true);
        int len = (int) header.getPayloadLength();
        byte[] buffer = new byte[len];
        InputUtil.readFully(in, buffer, 0, len);
        return new ByteArrayVIntTrieLookup(buffer);
    }
View Full Code Here

Examples of com.ning.tr13.lookup.TrieHeader

    }

    public static VIntTrieLookup readByteBufferVIntTrie(InputStream in, ByteBufferAllocator a)
        throws IOException
    {
        TrieHeader header = _readHeader(in, true);
        int len = (int) header.getPayloadLength();
        ByteBuffer bb = a.allocate(len);
        byte[] buffer = new byte[16000];
        while (len > 0) {
            int count = in.read(buffer, 0, Math.min(len, buffer.length));
            if (count < 0) {
View Full Code Here

Examples of com.ning.tr13.lookup.TrieHeader

        return trie;
    }

    public static BytesTrieLookup readByteArrayBytesTrie(InputStream in) throws IOException
    {
        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

Examples of com.ning.tr13.lookup.TrieHeader

    }

    public static BytesTrieLookup readByteBufferBytesTrie(InputStream in, ByteBufferAllocator a)
        throws IOException
    {
        TrieHeader header = _readHeader(in, true);
        int len = (int) header.getPayloadLength();
        ByteBuffer bb = a.allocate(len);
        byte[] buffer = new byte[16000];
        while (len > 0) {
            int count = in.read(buffer, 0, Math.min(len, buffer.length));
            if (count < 0) {
View Full Code Here

Examples of com.ning.tr13.lookup.TrieHeader

   
    protected static TrieHeader _readHeader(InputStream in, boolean twoGigMax) throws IOException
    {
        byte[] buffer = new byte[TrieHeader.HEADER_LENGTH];
        InputUtil.readFully(in, buffer, 0, TrieHeader.HEADER_LENGTH);  
        TrieHeader h = TrieHeader.read(buffer, 0);
        if (twoGigMax) {
            if (h.getPayloadLength() > Integer.MAX_VALUE) {
                throw new IllegalArgumentException("Trie over 2 gigs in size: max size 2 gigs");
            }
        }
        return h;
   
View Full Code Here

Examples of com.ning.tr13.lookup.TrieHeader

    {
        // header:
        byte[] buffer = new byte[TrieHeader.HEADER_LENGTH];
        InputUtil.readFully(in, buffer);
        // First: let's verify signature, header
        TrieHeader header = TrieHeader.read(buffer, 0);
        long len = header.getPayloadLength();
        if (len > Integer.MAX_VALUE) {
            throw new IOException("Too big input file (over 2 gigs)");
        }
        byte[] payload = new byte[(int) len];
        InputUtil.readFully(in, payload);
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.