Use with OnStack idiom for temporary char buffers
Use with OnStack idiom for temporary char buffers
Provides a new buffered data output stream.
Provides a new buffered data output stream. Note that this must be completely configured (byteOrder, encoding, bitOrder, etc.)
advances the bit position to the specified alignment.
advances the bit position to the specified alignment.
Note that the bitAlignment1b argument is 1-based.
Passing 0 as the argument is a usage error.
Passing 1 as the argument performs no alignment, as any bit position is 1-bit aligned.
For any other value, the bit position (1-based) is advanced to the next multiple of that argument value.
False is returned if there are insufficient available bits to achieve the alignment.
Debugging flag.
Debugging flag. If set then performance may be reduced, but historic and upcoming data may be viewed using the pastData and futureData methods.
This should be set at the beginning of execution. If it is set after data has been accessed then IllegalStateException is thrown.
Offset within the first byte to the first bit.
Offset within the first byte to the first bit. This is the number of bits to skip. Value is from 0 to 7.
Two of these are equal if they are eq.
Two of these are equal if they are eq. This matters because we compare them to see if we are making forward progress
This is for debugging.
This is for debugging. It works backward through the chain of DOS' until it finds one that is holding things up (preventing collapsing) by not having any absolute position information, or being still active.
Must be val, as split-from will get reset to null as streams are morphed into direct streams.
Must be val, as split-from will get reset to null as streams are morphed into direct streams.
For assertion checking really.
For assertion checking really. Optimizations should remove the need for most alignment operations. This can be used in assertions that check that this is working properly.
Note that the bitAlignment1b argument is 1-based.
Passing 0 as the argument is a usage error.
Passing 1 as the argument performs no alignment, as any bit position is 1-bit aligned.
Absolute bit limit zero based
Absolute bit limit zero based
If defined it is the position 1 bit past the last bit location that can be written. So if we at starting at bitPos0b of 0, and we allow only 100 bits, then the bit positions are 0 to 99, and the bit limit is 100.
This override implements a critical behavior, which is that when we ask for an absolute bit position, if we have it great.
This override implements a critical behavior, which is that when we ask for an absolute bit position, if we have it great. if we don't, we look at the prior DOS to see if it is finished and has an absolute bit position. If so that bit position becomes this DOS abs starting bit position, and then our absolute bit position is known.
Without this behavior, it's possible for the unparse to hang, with every DOS chained together, but they all get finished in just the wrong order, and so the content or value length of something late in the data can't be determined that is needed to determine something early in the schema. Unless this absolute position information is propagated forward, everything can hang.
Recursively this reaches backward until it finds a non-finished DOS or one that doesn't have absolute positioning information.
I guess worst case this is a bad algorithm in that this could recurse deeply, going all the way back to the very start, over and over again. A better algorithm would depend on forward push of the absolute positioning information when setFinished occurs, which is, after all, the time when we can push such info forward.
However, see setFinished comment. Where we setFinished and there is a following DOS we reach forward and ask that for its maybeAbsBitPos0b, which pulls the information forward by one DOS in the chain. So this chain should never be very long.
the starting bit pos is undefined to start.
the starting bit pos is undefined to start. then it is in many cases set to some value n, because we know in advance how long the prior data is. Then when absorbed into the direct stream, the stream technically starts at 0, but we need to keep track of the former starting bit pos so as to be able to convert relative positions to absolute positions correctly.
Relative bit limit zero based
Relative bit limit zero based
Access to historic (past data) and upcoming data for purposes of display in a trace or debugger.
Access to historic (past data) and upcoming data for purposes of display in a trace or debugger.
If areDebugging is false, these throw IllegalStateException
If bitLengthFrom1 bits are available to be written before bitLimit0b (if defined) is encountered, then this writes the bitLengthFrom1 least significant bits of the bigInt using the current bit order and byte order, and returns true.
If bitLengthFrom1 bits are available to be written before bitLimit0b (if defined) is encountered, then this writes the bitLengthFrom1 least significant bits of the bigInt using the current bit order and byte order, and returns true. The signed flag determines whether or not the output should be output as a signed or unsigned type.
If not enough bits are available or the big integer cannot fit into bitLengthFrom1 bits, this writes nothing and returns false.
It is a usage error if signed is false and bigInt is a negative BigInteger.
It is a usage error if bitLengthFrom1 is not greater than or equal to 1.
Float and Double
Float and Double
These are unparsed per the currently set BinaryFloatRep, byteOrder, and bitOrder
Returns false if there are not 32 bits or 64 bits (respectively) available.
If bitLengthFrom1 bits are available to be written before bitLimit0b (if defined) is encountered, then this writes the bitLengthFrom1 bits of the ba using the current bit order and byte order, and returns true.
If bitLengthFrom1 bits are available to be written before bitLimit0b (if defined) is encountered, then this writes the bitLengthFrom1 bits of the ba using the current bit order and byte order, and returns true. The array is assumed to be have bigEndian byte order and most significant bit first bit order.
If not enough bits are available, this writes nothing and returns false.
It is a usage error if bitLengthFrom1 is not greater than or equal to 1.
Returns number of bytes transferred.
Returns number of bytes transferred. Stops when the bitLimit is encountered if one is defined.
If bitLengthFrom1To64 bits are available to be written before bitLimit0b (if defined) is encountered, then this writes the bitLengthFrom1To64 least significant bits of the long using the current bit order and byte order, and returns true.
If bitLengthFrom1To64 bits are available to be written before bitLimit0b (if defined) is encountered, then this writes the bitLengthFrom1To64 least significant bits of the long using the current bit order and byte order, and returns true.
If not enough bits are available, this writes nothing and returns false.
It is a usage error if bitLengthFrom1To64 is not in the range 1 to 64 inclusive.
Use when calling from a put/write operation that has already checked the length limit.
Use when calling from a put/write operation that has already checked the length limit.
Assumed to be called from inner loops, so should be fast as possible.
Always writes out at least 1 bit.
Always writes out at least 1 bit.
Returns number of characters transferred.
Returns number of characters transferred. Stops when the bitLimit is encountered if one is defined.
If bitLengthFrom1To64 bits are available to be written before bitLimit0b (if defined) is encountered, then this writes the bitLengthFrom1To64 least significant bits of the long using the current bit order and byte order, and returns true.
If bitLengthFrom1To64 bits are available to be written before bitLimit0b (if defined) is encountered, then this writes the bitLengthFrom1To64 least significant bits of the long using the current bit order and byte order, and returns true.
If not enough bits are available, this writes nothing and returns false.
It is a usage error if bitLengthFrom1To64 is not in the range 1 to 64 inclusive.
just a synonym
just a synonym
Returns number of bits remaining (if a limit is defined).
Returns number of bits remaining (if a limit is defined). Nope if not defined.
close-out this output stream.
close-out this output stream. No more writing to this after.
Allow tuning of these thresholds and starting values.
Allow tuning of these thresholds and starting values. These could, in principle, be tuned differently for different elements, thereby keeping limits small when the schema component can be determined to only require small space, but enabling larger limits/starting values when a component has larger needs.
These could be cached on, say, the ElementRuntimeData object for each element, or some other kind of dynamic cache.
sets, but also maintains the absolute bit limit, if that is defined.
sets, but also maintains the absolute bit limit, if that is defined.
Returns false if the set was unsuccessful, meaning one is setting a limit that extends past a pre-existing limit.
Besides setting the relBitPos, it also maintains the value of the absolute bit pos, if it is known.
Besides setting the relBitPos, it also maintains the value of the absolute bit pos, if it is known.
Advances the bit position by nBits.
Advances the bit position by nBits. If nBits aren't available this returns false. Otherwise it returns true.
Called once after each parse operation to verify final invariants for the implementation.
Called once after each parse operation to verify final invariants for the implementation.
Use to perform checks such as that data structures held in pools are all returned before end of parse.
To support dfdl:outputValueCalc, we must suspend output. This is done by taking the current "direct" output, and splitting it into a still direct part, and a following buffered output.
The direct part waits for the OVC calculation to complete, when that is written, it is finished and collapses into the following, which was buffered, but becomes direct as a result of this collapsing.
Hence, most output will be to direct data output streams, with some, while an OVC is pending, will be buffered, but this is eliminated as soon as possible.
A Buffered DOS can be finished or not. Not finished means that it might still be appended to. Not concurrently, but by other code invoked from this thread of control (which might traverse different co-routine "stack" threads, but it's still one thread of control).
Finished means that the Buffered DOS can never be appended to again.
Has two modes of operation, buffering or direct. When buffering, all output goes into a buffer. When direct, all output goes into a "real" DataOutputStream.