Package com.ning.tr13.impl.bytes

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


   
    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

      throw new RuntimeException("Failed to add routes for " + routeControllerClass + ".", t);
    }

    for (Method routeMethod : routeControllerClass.getDeclaredMethods()) {
      String routeMethodName = routeMethod.getName();
      Path pathAnnotation = routeMethod.getAnnotation(Path.class);
      Paths pathsAnnotation = routeMethod.getAnnotation(Paths.class);
      if (pathAnnotation != null || pathsAnnotation != null) {
        String actionName;
        if (routeMethodName.endsWith("Action")) {
          actionName = routeMethodName.substring(0, routeMethodName.length() - "Action".length());
        }
        else {
          actionName = routeMethodName;
        }

        ERXRoute.Method method = null;
        // Search annotations for @PUT, @GET, etc.
        for (Annotation annotation : routeMethod.getAnnotations()) {
          HttpMethod httpMethod = annotation.annotationType().getAnnotation(HttpMethod.class);
          if (httpMethod != null) {
            if (method == null) {
              method = httpMethod.value();
            }
            else {
              throw new IllegalArgumentException(routeControllerClass.getSimpleName() + "." + routeMethod.getName() + " is annotated as more than one http method.");
            }
          }
        }

        // Finally default declared REST actions to @GET
        if (method == null) {
          method = ERXRoute.Method.Get;
        }

        if (pathAnnotation != null) {
          addRoute(new ERXRoute(entityName, pathAnnotation.value(), method, routeControllerClass, actionName));
          declaredRoutesFound = true;
        }
        if (pathsAnnotation != null) {
          for (Path path : pathsAnnotation.value()) {
            addRoute(new ERXRoute(entityName, path.value(), method, routeControllerClass, actionName));
View Full Code Here

TOP

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

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.