Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.koushikdutta.ion;
  
 
Created by koush on 6/13/13.
 
     public RequestBodyUploadObserver(AsyncHttpRequestBody bodyProgressCallback callback) {
         this. = body;
         this. = callback;
     }
 
     @Override
     public void write(AsyncHttpRequest requestfinal DataSink sinkfinal CompletedCallback completed) {
         final int length = .length();
         .write(requestnew DataSink() {
             int totalWritten;
             @Override
             public void write(ByteBuffer bb) {
                 int start = bb.remaining();
                 sink.write(bb);
                 int wrote = start - bb.remaining();
                  += wrote;
                 .onProgress(length);
             }
 
             @Override
             public void write(ByteBufferList bb) {
                 int start = bb.remaining();
                 sink.write(bb);
                 int wrote = start - bb.remaining();
                  += wrote;
                 .onProgress(length);
             }
 
             @Override
             public void setWriteableCallback(WritableCallback handler) {
                 sink.setWriteableCallback(handler);
             }
 
             @Override
             public WritableCallback getWriteableCallback() {
                 return sink.getWriteableCallback();
             }
 
             @Override
             public boolean isOpen() {
                 return sink.isOpen();
             }
 
             @Override
             public void close() {
                 sink.close();
             }
 
             @Override
             public void end() {
                 sink.end();
             }
 
             @Override
             public void setClosedCallback(CompletedCallback handler) {
                 sink.setClosedCallback(handler);
             }
 
             @Override
             public CompletedCallback getClosedCallback() {
                 return sink.getClosedCallback();
             }
 
             @Override
             public AsyncServer getServer() {
                 return sink.getServer();
             }
         }, completed);
     }
 
     @Override
     public void parse(DataEmitter emitterCompletedCallback completed) {
         .parse(emittercompleted);
     }
 
     @Override
     public String getContentType() {
         return .getContentType();
     }
 
    @Override
    public boolean readFullyOnRequest() {
        return .readFullyOnRequest();
    }
    @Override
    public int length() {
        return .length();
    }
    @Override
    public Object get() {
        return .get();
    }
New to GrepCode? Check out our FAQ X