// Path: src/main/java/org/jruby/jubilee/Const.java
// public final class Const {
// 
//     public static final String JUBILEE_VERSION = "Jubilee(3.0.0)";
// 
//     public static final String LOCALHOST = "localhost";
//     public static final String PORT_80 = "80";
//     public static final String MULTI_THREADED = "rack.multithread";
//     public static class Vertx {
//         public static final String CONTENT_LENGTH = "Content-Length";
//     }
// 
//     public static final String HTTP = "http";
//     public static final String HTTPS = "https";
//     public static final String HOST = "Host";
// 
//     private Const() {
//     }
// 
//     // Internal
//     public static final byte EOL = '\n';
// }


import io.netty.buffer.ByteBuf;
import org.jcodings.Encoding;
import org.jcodings.specific.ASCIIEncoding;
import org.jruby.*;
import org.jruby.anno.JRubyMethod;
import org.jruby.jubilee.Const;
import org.jruby.jubilee.RackInput;
import org.jruby.runtime.Block;
import org.jruby.runtime.ObjectAllocator;
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.builtin.IRubyObject;
import org.jruby.util.ByteList;
import org.jruby.util.StringSupport;
import java.util.concurrent.atomic.AtomicBoolean;
import io.vertx.core.http.HttpServerRequest;
package org.jruby.jubilee.impl;




/**
 * Created with IntelliJ IDEA.
 * User: isaiah
 * Date: 11/26/12
 * Time: 10:12 PM
 */
public class RubyIORackInput extends RubyObject implements RackInput {
    private Encoding BINARY = ASCIIEncoding.INSTANCE;
    private int len;
    private boolean chunked;
    private ByteBuf buf;
    private AtomicBoolean eof;

    public static ObjectAllocator ALLOCATOR = new ObjectAllocator() {
        @Override
        public IRubyObject allocate(Ruby ruby, RubyClass rubyClass) {
            return new RubyIORackInput(ruby, rubyClass);
        }
    };

    public static RubyClass createIORackInputClass(Ruby runtime) {
        RubyModule jModule = runtime.getOrCreateModule("Jubilee");
        RubyClass rackIOInputClass = jModule.defineClassUnder("IORackInput", runtime.getObject(), ALLOCATOR);
        rackIOInputClass.defineAnnotatedMethods(RubyIORackInput.class);
        return rackIOInputClass;
    }

    public RubyIORackInput(Ruby runtime, RubyClass metaClass) {
        super(runtime, metaClass);
    }

    public RubyIORackInput(Ruby runtime, RubyClass rubyClass, HttpServerRequest request, ByteBuf buf, AtomicBoolean eof) {
        this(runtime, rubyClass);
// Path: src/main/java/org/jruby/jubilee/Const.java
// public final class Const {
// 
//     public static final String JUBILEE_VERSION = "Jubilee(3.0.0)";
// 
//     public static final String LOCALHOST = "localhost";
//     public static final String PORT_80 = "80";
//     public static final String MULTI_THREADED = "rack.multithread";
//     public static class Vertx {
//         public static final String CONTENT_LENGTH = "Content-Length";
//     }
// 
//     public static final String HTTP = "http";
//     public static final String HTTPS = "https";
//     public static final String HOST = "Host";
// 
//     private Const() {
//     }
// 
//     // Internal
//     public static final byte EOL = '\n';
// }


// Path: src/main/java/org/jruby/jubilee/impl/RubyIORackInput.java
import io.netty.buffer.ByteBuf;
import org.jcodings.Encoding;
import org.jcodings.specific.ASCIIEncoding;
import org.jruby.*;
import org.jruby.anno.JRubyMethod;
import org.jruby.jubilee.Const;
import org.jruby.jubilee.RackInput;
import org.jruby.runtime.Block;
import org.jruby.runtime.ObjectAllocator;
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.builtin.IRubyObject;
import org.jruby.util.ByteList;
import org.jruby.util.StringSupport;
import java.util.concurrent.atomic.AtomicBoolean;
import io.vertx.core.http.HttpServerRequest;

package org.jruby.jubilee.impl;




/**
 * Created with IntelliJ IDEA.
 * User: isaiah
 * Date: 11/26/12
 * Time: 10:12 PM
 */
public class RubyIORackInput extends RubyObject implements RackInput {
    private Encoding BINARY = ASCIIEncoding.INSTANCE;
    private int len;
    private boolean chunked;
    private ByteBuf buf;
    private AtomicBoolean eof;

    public static ObjectAllocator ALLOCATOR = new ObjectAllocator() {
        @Override
        public IRubyObject allocate(Ruby ruby, RubyClass rubyClass) {
            return new RubyIORackInput(ruby, rubyClass);
        }
    };

    public static RubyClass createIORackInputClass(Ruby runtime) {
        RubyModule jModule = runtime.getOrCreateModule("Jubilee");
        RubyClass rackIOInputClass = jModule.defineClassUnder("IORackInput", runtime.getObject(), ALLOCATOR);
        rackIOInputClass.defineAnnotatedMethods(RubyIORackInput.class);
        return rackIOInputClass;
    }

    public RubyIORackInput(Ruby runtime, RubyClass metaClass) {
        super(runtime, metaClass);
    }

    public RubyIORackInput(Ruby runtime, RubyClass rubyClass, HttpServerRequest request, ByteBuf buf, AtomicBoolean eof) {
        this(runtime, rubyClass);
        String hdr = request.headers().get(Const.Vertx.CONTENT_LENGTH);