Package com.ning.tr13.impl.bytes

Examples of com.ning.tr13.impl.bytes.ByteBufferBytesTrieLookup


   
    public static BytesTrieLookup readByteBufferBytesTrie(File f, ByteBufferAllocator a)
        throws IOException
    {
        FileInputStream fis = new FileInputStream(f);
        BytesTrieLookup trie = readByteBufferBytesTrie(fis, a);
        fis.close();
        return trie;
    }
View Full Code Here


        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

    }

    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

        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

    }

    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

   
    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

    {
        // 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

     */

    public static VIntTrieLookup readByteArrayVIntTrie(File f) throws IOException
    {
        FileInputStream fis = new FileInputStream(f);
        VIntTrieLookup trie = readByteArrayVIntTrie(fis);
        fis.close();
        return trie;
    }
View Full Code Here

   
    public static VIntTrieLookup readByteBufferVIntTrie(File f, ByteBufferAllocator a)
        throws IOException
    {
        FileInputStream fis = new FileInputStream(f);
        VIntTrieLookup trie = readByteBufferVIntTrie(fis, a);
        fis.close();
        return trie;
    }
View Full Code Here

TOP

Related Classes of com.ning.tr13.impl.bytes.ByteBufferBytesTrieLookup

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.