stevedlawrence commented on code in PR #1652:
URL: https://github.com/apache/daffodil/pull/1652#discussion_r3398959395
##########
daffodil-core/src/main/scala/org/apache/daffodil/io/InputSource.scala:
##########
@@ -645,4 +683,12 @@ class ByteBufferInputSource(byteBuffer: ByteBuffer)
extends InputSource {
override def close(): Unit = {
// do nothing. No resources to release.
}
+
+ /**
+ * Returns the 0-based exclusive byte position of the end of the buffer data.
+ */
+ override def optEndOfDataPosition: Option[Long] = {
+ val finalPosition = position() + bb.remaining
+ Some(finalPosition)
+ }
Review Comment:
Not sure if this is that important, but we could calculate this when the
`ByteBufferInputSource` is initialized. We don't have to recalculate it based
on the current position. Something like
```scala
override val optEndOfDataPosition: Option[Long] = Some(bb.remaining)
```
By definition the EOD is of the this input source is however much is
remaining when it's created.
--
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]