Codota Logo
FeedableBodyGenerator
Code IndexAdd Codota to your IDE (free)

How to use
FeedableBodyGenerator
in
org.asynchttpclient.request.body.generator

Best Java code snippets using org.asynchttpclient.request.body.generator.FeedableBodyGenerator (Showing top 14 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
DateTime d =
  • Codota Iconnew DateTime()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseDateTime(text)
  • Codota IconObject instant;new DateTime(instant)
  • Smart code suggestions by Codota
}
origin: AsyncHttpClient/async-http-client

@Override
public boolean feed(ByteBuf buffer, boolean isLast) throws Exception {
 return feedableBodyGenerator.feed(buffer, isLast);
}
origin: AsyncHttpClient/async-http-client

@Override
public void setListener(FeedListener listener) {
 feedListener = listener;
 feedableBodyGenerator.setListener(listener);
}
origin: AsyncHttpClient/async-http-client

public StreamedBody(FeedableBodyGenerator bodyGenerator, long contentLength) {
 this.body = bodyGenerator.createBody();
 this.subscriber = new SimpleSubscriber(bodyGenerator);
 this.contentLength = contentLength;
}
origin: org.asynchttpclient/async-http-client-netty3

if (bg instanceof FeedableBodyGenerator) {
  final FeedableBodyGenerator feedableBodyGenerator = (FeedableBodyGenerator) bg;
  feedableBodyGenerator.writeChunkBoundaries();
  feedableBodyGenerator.setListener(new FeedListener() {
    @Override
    public void onContentAdded() {
origin: org.asynchttpclient/async-http-client-api

@Override
public void writeChunkBoundaries() {
  feedableBodyGenerator.writeChunkBoundaries();
}
origin: AsyncHttpClient/async-http-client

 @Override
 public void onComplete() {
  try {
   feeder.feed(Unpooled.EMPTY_BUFFER, true);
  } catch (Exception e) {
   LOGGER.info("Ignoring exception occurred while completing stream processing.", e);
   this.subscription.cancel();
  }
 }
}
origin: AsyncHttpClient/async-http-client

if (bg instanceof FeedableBodyGenerator && !(bg instanceof ReactiveStreamsBodyGenerator)) {
 final ChunkedWriteHandler chunkedWriteHandler = channel.pipeline().get(ChunkedWriteHandler.class);
 FeedableBodyGenerator.class.cast(bg).setListener(new FeedListener() {
  @Override
  public void onContentAdded() {
origin: org.asynchttpclient/async-http-client-api

public StreamedBody(Publisher<ByteBuffer> publisher, FeedableBodyGenerator bodyGenerator) {
  this.body = bodyGenerator.createBody();
  this.subscriber = new SimpleSubscriber(bodyGenerator);
}
origin: AsyncHttpClient/async-http-client

@Override
public void onNext(ByteBuf b) {
 assertNotNull(b, "bytebuf");
 try {
  feeder.feed(b, false);
 } catch (Exception e) {
  LOGGER.error("Exception occurred while processing element in stream.", e);
  subscription.cancel();
 }
}
origin: org.asynchttpclient/async-http-client-api

@Override
public void setListener(FeedListener listener) {
  feedListener.set(listener);
  feedableBodyGenerator.setListener(listener);
}
origin: AsyncHttpClient/async-http-client

private void feed(FeedableBodyGenerator feedableBodyGenerator, InputStream is) throws Exception {
 try (InputStream inputStream = is) {
  byte[] buffer = new byte[512];
  for (int i; (i = inputStream.read(buffer)) > -1; ) {
   byte[] chunk = new byte[i];
   System.arraycopy(buffer, 0, chunk, 0, i);
   feedableBodyGenerator.feed(Unpooled.wrappedBuffer(chunk), false);
  }
 }
 feedableBodyGenerator.feed(Unpooled.EMPTY_BUFFER, true);
}
origin: org.asynchttpclient/async-http-client-api

@Override
public void feed(ByteBuffer buffer, boolean isLast) {
  feedableBodyGenerator.feed(buffer, isLast);
}
origin: org.asynchttpclient/async-http-client-api

@Override
public void onNext(ByteBuffer t) {
  if (t == null) throw null;
  try {
    feeder.feed(t, false);
  } catch (Exception e) {
    LOGGER.error("Exception occurred while processing element in stream.", e);
    subscription.cancel();
  }
}
origin: org.asynchttpclient/async-http-client-api

  @Override
  public void onComplete() {
    try {
     feeder.feed(EMPTY, true);
    } 
    catch (Exception e) {
      LOGGER.info("Ignoring exception occurred while completing stream processing.", e);
      this.subscription.cancel();
    }
  }
}
org.asynchttpclient.request.body.generatorFeedableBodyGenerator

Javadoc

BodyGenerator which may return just part of the payload at the time handler is requesting it. If it happens, client becomes responsible for providing the rest of the chunks.

Most used methods

  • feed
  • setListener
  • createBody
  • writeChunkBoundaries

Popular in Java

  • Creating JSON documents from java classes using gson
  • startActivity (Activity)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • getSystemService (Context)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • Kernel (java.awt.image)
  • InputStreamReader (java.io)
    An InputStreamReader is a bridge from byte streams to character streams: It reads bytes and decodes
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • Properties (java.util)
    The Properties class represents a persistent set of properties. The Properties can be saved to a st
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now