stevedlawrence commented on a change in pull request #489:
URL: https://github.com/apache/incubator-daffodil/pull/489#discussion_r572935732
##########
File path:
daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/unparsers/UState.scala
##########
@@ -366,16 +364,15 @@ abstract class UState(
*/
final class UStateForSuspension(
val mainUState: UStateMain,
- dos: DirectOrBufferedDataOutputStream,
+ override var dataOutputStream: DirectOrBufferedDataOutputStream,
Review comment:
This patch changes things so the UState abstract class requires that the
implementations have a dataOutputStream var.
For this UStateForSuspension, this var is initially set when the UStateMain
is cloned to create the UStateForSuspension. I think this var in
UStateForSuspension should never actually change, but it needs to be a var
because UState abstract class require it be a var.
For the dataOutputStream in UStateMain, it is set initially when the
UStateMain is created as part of this patch.
This dataOutputStream actually changes to point to different DOS's in just a
few places in existing code (none of which needed to change, the logic for
removing references if needed was already there). Those places are essentially
anytime we create a new DOS and it updates the dataOutputStream in UStateMain
to point to that new DOS.
For example, in the UState abstract class we have the
``splitOnUknownByteAlignmentBitOrderChange`` function which can create a split
and change this dataOutputStream to the new DOS. Likewise the ``splitDOS``
function in ``Suspensions.scala`` will create a new DOS and change the UState
dataOutputStream. BlobLengthUnparser and LayeredSequnceUnparser do similar
things.
So the code that actually changes the dataOutputStream is a bit spread out,
but only in a couple of places. But also was correct and didn't need changes.
These changes are really just so the initial DOS isn't on the stack in the
unparse() function.
----------------------------------------------------------------
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:
[email protected]