davsclaus commented on code in PR #27757:
URL: https://github.com/apache/camel/pull/27757#discussion_r4255595813
##########
components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyChannelBufferStreamCache.java:
##########
@@ -46,14 +46,20 @@ public NettyChannelBufferStreamCache(ByteBuf buffer) {
this.buffer.markReaderIndex();
}
+ /**
+ * Marking is not supported: {@link #mark(int)} does nothing, and {@link
#reset()} always goes back to the start of
+ * the body, which is what {@link StreamCache#reset()} is for. A reader
that needs mark support has to wrap this
+ * stream (for example in a {@link java.io.BufferedInputStream}), and so
cannot change where a reset goes back to.
+ */
@Override
public boolean markSupported() {
- return true;
+ return false;
}
@Override
public int read() {
- return buffer.readByte();
+ // an unsigned byte, and -1 at the end, as InputStream requires
+ return buffer.isReadable() ? buffer.readByte() & 0xFF : -1;
}
Review Comment:
Optional, not needed for this fix; leaving it.
_Claude Code on behalf of @davsclaus._
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]