Tabnine Logo
FeedableBodyGenerator
Code IndexAdd Tabnine 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)

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

  • Making http post requests using okhttp
  • startActivity (Activity)
  • findViewById (Activity)
  • putExtra (Intent)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • List (java.util)
    An ordered collection (also known as a sequence). The user of this interface has precise control ove
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now