stevedlawrence commented on a change in pull request #254: Adds hex/utf-8 data dump on left over data URL: https://github.com/apache/incubator-daffodil/pull/254#discussion_r298569461
########## File path: daffodil-cli/src/main/scala/org/apache/daffodil/Main.scala ########## @@ -905,13 +907,26 @@ object Main extends Logging { } } else { // not streaming, show left over data warning + val Dump = new DataDumper + var (dataText, dataHex) = ("", "") + var curPositionInByte0b = inStream.inputSource.position + var bytesAvailable = inStream.inputSource.bytesAvailable + var bytesLimit = math.min(8, bytesAvailable).toInt + val destArray = new Array[Byte](bytesLimit) + val ret = inStream.inputSource.get(destArray, 0, bytesLimit) Review comment: There are cases where this output might be misleading, primarly related when the left over bits do not start on a byte boundary. inputSource.get will get the raw underlying bytes, without regard to the bit offset. So if data ends mid-bit this is going to include those already read bits. I'm not sure of the best way to handle this. We doul use inStream.fillByteArray instead, which does take into account bits, but that stiill might be confusing showing full bytes that were offset by some amount of bits. But maybe this isn't a big deal? ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services