Hello,

 

I hope the last questions:

 

1.       The validateAfterInactivity with a value of zero means no
validation?

 

2.       Regarding the consume method, this is our implementation now:

 

@Override

public int consume(ByteBuffer src) throws IOException

{

  while (src.hasRemaining()) {

         byte[] dst = new byte[src.remaining()];

         src.get(dst, 0, src.remaining());

         this.vbaos.write(dst);

  }

 

  return ????;

}

 

Triggered to pass incoming data to the data consumer. The consumer must
consume the entire content of the data buffer.

è Is this the right (and optimal) way to consume the data buffer?

 

The consumer must stop incrementing its capacity on the capacity channel and
must return zero capacity from this method if it is unable to accept more
data. Once the data consumer has handled accumulated data or allocated more
intermediate storage it can update its capacity information on the capacity
channel.

è Here I must admit I don’t understand this sentence at all. After googling
a lot and reviewing your samples, I couldn’t find an example of consume
method working with byte buffers (just with CharBuffer in the
‘AsyncClientHttpExchangeStreaming.java’, but in this case no value is
returned in ‘data’ function). 

         protected void data(final CharBuffer data, final boolean
endOfStream) throws IOException {

while (data.hasRemaining()) {

 System.out.print(data.get());

}

if (endOfStream) {

 System.out.println();

}

}

 

What is the suggested value to return in this function?

 

Thanks,

 

Joan.

Reply via email to