Hi,

I'm searching for an elegant solution of the following problem:

I have a incoming bytebuffer. I know two positions A and B on it. The current position is actually B with more remaining data behind. Now I want to process the buffer between these two positions while hiding the rest of the buffer for the meantime. I don't want to use slice() because of the extra copy costs.

My current solution looks as follows:

int limit = in.limit();
in.flip();
in.position( A );

... process data

in.limit( limit );
in.position( B );

Would it work correctly? What would be the best way to solve this?

Best Regards
Michael

Reply via email to