class DirectOrBufferedDataOutputStream extends DataOutputStreamImplMixin

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.

The isLayer parameter defines whether or not this instance originated from a layer or not. This is important to specify because this class is reponsible for closing the associated Java OutputStream, ultimately being written to the underlying underlying DataOutputStream. However, if the DataOutputStream is not related to a layer, that means the associated Java OutputStream came from the user and it is the users responsibility to close it. The isLayer provides the flag to know which streams should be closed or not.

chunkSizeInBytes is used when the buffered output stream is using a file as its buffer. This is the size of chunks that will be read into memory before being written to the direct output stream.

maxBufferSizeInByte is the size that the ByteArrayOutputStream will grow to before switching over to a FileOutputStream

tempDirPath is the path where temporary files will be created when switching to a file based buffer

maybeExistingFile is used in the case of blob files, where we already have an existing file containing the data. This is the path to said file.

Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. DirectOrBufferedDataOutputStream
  2. DataOutputStreamImplMixin
  3. LocalBufferMixin
  4. DataStreamCommonImplMixin
  5. DataOutputStream
  6. DataStreamCommon
  7. DataStreamCommonState
  8. AnyRef
  9. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. type ThisType = DirectOrBufferedDataOutputStream
  2. final class LocalByteBuffer extends LocalBuffer[ByteBuffer]
    Definition Classes
    LocalBufferMixin
  3. final class LocalCharBuffer extends LocalBuffer[CharBuffer]

    Use with OnStack idiom for temporary char buffers

    Use with OnStack idiom for temporary char buffers

    Definition Classes
    LocalBufferMixin

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. var _javaOutputStream: OutputStream

    Switched to point a either the buffering or direct java output stream in order to change modes from buffering to direct (and back if these objects get reused.)

    Switched to point a either the buffering or direct java output stream in order to change modes from buffering to direct (and back if these objects get reused.)

    Attributes
    protected
  5. def addBuffered(): DirectOrBufferedDataOutputStream

    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.)

  6. def addBufferedBlob(path: Path, lengthInBits: Long, blobChunkSizeInBytes: Int, finfo: FormatInfo): DirectOrBufferedDataOutputStream
  7. final def align(bitAlignment1b: Int, finfo: FormatInfo): Boolean

    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.

    Definition Classes
    DataOutputStreamImplMixinDataStreamCommon
  8. final def areDebugging: Boolean

    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.

    Definition Classes
    DataStreamCommonImplMixinDataStreamCommon
  9. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  10. def assignFrom(other: DataOutputStreamImplMixin): Unit
    Attributes
    protected
    Definition Classes
    DataOutputStreamImplMixin
  11. def assignFrom(other: DataStreamCommonState): Unit
    Definition Classes
    DataStreamCommonState
  12. val bitStartOffset0b: Int

    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.

    Definition Classes
    DataOutputStreamImplMixin
  13. val bufferingJOS: ByteArrayOrFileOutputStream

    When in buffering mode, this is the buffering device.

    When in buffering mode, this is the buffering device.

    If reused, this must be reset.

    Attributes
    protected
  14. val chunkSizeInBytes: Int

    These values are used for output streams that could change from ByteArray's to File based output streams.

    These values are used for output streams that could change from ByteArray's to File based output streams.

    Definition Classes
    DirectOrBufferedDataOutputStreamDataOutputStream
  15. def cleanUp(): Unit

    Clean up any temporary files that were generated

    Clean up any temporary files that were generated

    Definition Classes
    DirectOrBufferedDataOutputStreamDataOutputStream
  16. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  17. final def cst: DataOutputStreamImplMixin
    Attributes
    protected
    Definition Classes
    DataOutputStreamImplMixinDataStreamCommonImplMixin
  18. val debugOutputStream: Maybe[ByteArrayOutputStream]
    Definition Classes
    DataOutputStreamImplMixin
  19. val debugging: Boolean
    Definition Classes
    DataStreamCommonState
  20. def deliverContent(directDOS: DirectOrBufferedDataOutputStream, finfo: FormatInfo): Unit

    Delivers the bits of this DOS's buffer into the given directDOS's output stream.

    Delivers the bits of this DOS's buffer into the given directDOS's output stream. Deals with the possibility that the directDOS ends with a fragment byte, or the bufDOS does, or both. Handles file based buffers as well.

    Attributes
    protected
  21. final def dosState: DOSState
    Definition Classes
    DataOutputStreamImplMixin
    Annotations
    @inline()
  22. def dumpChain(): Unit

    Helpful when debugging suspension or data output stream issues.

    Helpful when debugging suspension or data output stream issues. Outputs the list of all DataOutputStreams connected to this one, with a marker pointing to this stream

  23. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  24. def equals(other: Any): Boolean

    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

    Definition Classes
    DirectOrBufferedDataOutputStream → AnyRef → Any
  25. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  26. def findFirstBlocking: DirectOrBufferedDataOutputStream

    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.

  27. def fragmentLastByte: Int
    Definition Classes
    DataOutputStreamImplMixin
  28. def fragmentLastByteLimit: Int
    Definition Classes
    DataOutputStreamImplMixin
  29. final def futureData(nBytesRequested: Int): ByteBuffer
  30. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  31. def getJavaOutputStream(): OutputStream
  32. def hashCode(): Int
    Definition Classes
    DirectOrBufferedDataOutputStream → AnyRef → Any
  33. lazy val id: String

    id will be a N.M type identifier where N is the layer number, and M is the splitID.

    id will be a N.M type identifier where N is the layer number, and M is the splitID.

    Definition Classes
    DirectOrBufferedDataOutputStreamDataOutputStream
  34. final def isAligned(bitAlignment1b: Int): Boolean

    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.

    Definition Classes
    DataOutputStreamImplMixinDataStreamCommon
  35. final def isBuffering: Boolean
  36. def isEndOnByteBoundary: Boolean
    Definition Classes
    DataOutputStreamImplMixin
  37. final def isFinished: Boolean
    Definition Classes
    DataOutputStreamImplMixinDataOutputStream
    Annotations
    @inline()
  38. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  39. val isLayer: Boolean
  40. def lastInChain: DirectOrBufferedDataOutputStream
  41. val maxBufferSizeInBytes: Long
  42. val maybeAbsBitLimit0b: MaybeULong

    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.

    Definition Classes
    DataOutputStreamImplMixinDataOutputStream
  43. def maybeAbsBitPos0b: MaybeULong

    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.

    Definition Classes
    DirectOrBufferedDataOutputStreamDataOutputStreamImplMixinDataOutputStream
  44. final def maybeAbsStartingBitPos0b: MaybeULong

    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.

    Definition Classes
    DataOutputStreamImplMixin
  45. val maybeExistingFile: Maybe[Path]

    maybeExistingFile is used in the case of blob files, where we already have an existing file containing the data.

    maybeExistingFile is used in the case of blob files, where we already have an existing file containing the data. This is the path to said file.

    Definition Classes
    DirectOrBufferedDataOutputStreamDataOutputStream
  46. def maybeNextInChain: Maybe[DataOutputStream]
  47. def maybeRelBitLimit0b: MaybeULong

    Relative bit limit zero based

    Relative bit limit zero based

    Definition Classes
    DataOutputStreamImplMixinDataOutputStream
  48. val maybeTrailingSurrogateForUTF8: MaybeChar
    Definition Classes
    DataStreamCommonState
  49. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  50. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  51. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  52. final def pastData(nBytesRequested: Int): ByteBuffer

    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

    Definition Classes
    DataOutputStreamImplMixinDataStreamCommon
  53. def priorBitOrder: BitOrder
    Definition Classes
    DataStreamCommonState
  54. val priorBitPos: Long
    Definition Classes
    DataStreamCommonState
  55. final def putBigInt(bigInt: BigInteger, bitLengthFrom1: Int, signed: Boolean, finfo: FormatInfo): Boolean

    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.

    Definition Classes
    DataOutputStreamImplMixinDataOutputStream
  56. final def putBinaryDouble(v: Double, finfo: FormatInfo): Boolean
  57. final def putBinaryFloat(v: Float, finfo: FormatInfo): Boolean

    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.

    Definition Classes
    DataOutputStreamImplMixinDataOutputStream
  58. final def putByteArray(array: Array[Byte], bitLengthFrom1: Long, finfo: FormatInfo, ignoreByteOrder: Boolean = false): Boolean

    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.

    ignoreByteOrder is used when we are working with a FileOutputStream. Given that the bytes are already converted to BigEndian when they are written out to a file, we no longer need to convert little endian arrays so byte order can be ignored.

    It is a usage error if bitLengthFrom1 is not greater than or equal to 1.

    Definition Classes
    DataOutputStreamImplMixinDataOutputStream
  59. final def putBytes(ba: Array[Byte], byteStartOffset0b: Int, lengthInBytes: Int, finfo: FormatInfo): Long

    Returns number of bytes transferred.

    Returns number of bytes transferred. Stops when the bitLimit is encountered if one is defined.

    Definition Classes
    DataOutputStreamImplMixin
  60. final def putCharBuffer(cb: CharBuffer, finfo: FormatInfo): Long
  61. final def putFile(path: Path, lengthInBits: Long, chunkSizeInBytes: Int, finfo: FormatInfo): Long
    Definition Classes
    DataOutputStreamImplMixin
  62. def putLong(signedLong: Long, bitLengthFrom1To64: Int, finfo: FormatInfo): Boolean

    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.

    Definition Classes
    DirectOrBufferedDataOutputStreamDataOutputStream
  63. final def putLongChecked(signedLong: Long, bitLengthFrom1To64: Int, finfo: FormatInfo): Boolean
    Attributes
    protected
    Definition Classes
    DataOutputStreamImplMixin
  64. final def putLongUnchecked(signedLong: Long, bitLengthFrom1To64: Int, finfo: FormatInfo, ignoreByteOrder: Boolean = false): Boolean

    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.

    Attributes
    protected
    Definition Classes
    DataOutputStreamImplMixin
  65. final def putLong_BE_MSBFirst(signedLong: Long, bitLengthFrom1To64: Int): Boolean

    Always writes out at least 1 bit.

    Always writes out at least 1 bit.

    Attributes
    protected
    Definition Classes
    DirectOrBufferedDataOutputStreamDataOutputStreamImplMixin
  66. final def putLong_LE_LSBFirst(signedLong: Long, bitLengthFrom1To64: Int): Boolean
    Attributes
    protected
    Definition Classes
    DirectOrBufferedDataOutputStreamDataOutputStreamImplMixin
  67. final def putLong_LE_MSBFirst(signedLong: Long, bitLengthFrom1To64: Int): Boolean
    Attributes
    protected
    Definition Classes
    DirectOrBufferedDataOutputStreamDataOutputStreamImplMixin
  68. final def putString(str: String, finfo: FormatInfo): Long

    Returns number of characters transferred.

    Returns number of characters transferred. Stops when the bitLimit is encountered if one is defined.

    Definition Classes
    DataOutputStreamImplMixinDataOutputStream
  69. def putULong(unsignedLong: ULong, bitLengthFrom1To64: Int, finfo: FormatInfo): Boolean

    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.

    Definition Classes
    DirectOrBufferedDataOutputStreamDataOutputStream
  70. final def realStream: OutputStream

    just a synonym

    just a synonym

    Attributes
    protected
    Definition Classes
    DataOutputStreamImplMixin
  71. def relBitPos0b: ULong
  72. final def relBitPos1b: ULong
    Definition Classes
    DataOutputStream
  73. final def remainingBits: MaybeULong

    Returns number of bits remaining (if a limit is defined).

    Returns number of bits remaining (if a limit is defined). Nope if not defined.

    Definition Classes
    DataOutputStreamImplMixinDataStreamCommon
  74. def resetAllBitPos(): Unit
    Definition Classes
    DataOutputStreamImplMixin
  75. final def resetMaybeRelBitLimit0b(savedBitLimit0b: MaybeULong): Unit
  76. def resetUTF8SurrogatePairCapture(): Unit
    Definition Classes
    DataStreamCommonState
  77. def setAbsStartingBitPos0b(newStartingBitPos0b: ULong): Unit
    Definition Classes
    DataOutputStreamImplMixin
  78. final def setDOSState(newState: DOSState): Unit
    Attributes
    protected
    Definition Classes
    DataOutputStreamImplMixin
    Annotations
    @inline()
  79. final def setDebugging(setting: Boolean): Unit
  80. def setFinished(finfo: FormatInfo): Unit

    close-out this output stream.

    close-out this output stream. No more writing to this after.

    Definition Classes
    DirectOrBufferedDataOutputStreamDataOutputStream
  81. def setFragmentLastByte(newFragmentByte: Int, nBitsInUse: Int): Unit
    Definition Classes
    DataOutputStreamImplMixin
  82. def setJavaOutputStream(newOutputStream: OutputStream): Unit
  83. def setLengthInBits(newLengthInBits: ULong): Unit
    Definition Classes
    DataOutputStreamImplMixin
  84. def setMaybeRelBitLimit0b(newMaybeRelBitLimit0b: MaybeULong, reset: Boolean = false): Boolean

    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.

    Attributes
    protected
    Definition Classes
    DataOutputStreamImplMixinDataOutputStream
  85. final def setNonZeroLength(): Unit

    Must be called by anything that writes to the DOS if the amount written was 1 bit or more.

    Must be called by anything that writes to the DOS if the amount written was 1 bit or more.

    Attributes
    protected
    Definition Classes
    DataOutputStreamImplMixin
  86. def setPriorBitOrder(pbo: BitOrder): Unit
    Definition Classes
    DataStreamCommonState
  87. final def setRelBitPos0b(newRelBitPos0b: ULong): Unit

    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.

    Attributes
    protected
    Definition Classes
    DataOutputStreamImplMixinDataOutputStream
  88. final def skip(nBits: Long, finfo: FormatInfo): Boolean

    Advances the bit position by nBits.

    Advances the bit position by nBits. If nBits aren't available this returns false. Otherwise it returns true.

    Definition Classes
    DataOutputStreamImplMixinDataStreamCommon
  89. var splitFrom: DirectOrBufferedDataOutputStream
  90. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  91. val tempDirPath: File
  92. final def toAbsolute(relBitPos0b: ULong): ULong
    Definition Classes
    DataOutputStreamImplMixin
  93. def toString(): String
    Definition Classes
    DirectOrBufferedDataOutputStream → AnyRef → Any
  94. val unionByteBuffer: ByteBuffer
    Attributes
    protected
    Definition Classes
    DataOutputStreamImplMixin
  95. val unionLongBuffer: LongBuffer
    Attributes
    protected
    Definition Classes
    DataOutputStreamImplMixin
  96. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  97. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  98. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  99. final lazy val withLocalByteBuffer: LocalStack[LocalByteBuffer]
    Definition Classes
    LocalBufferMixin
  100. final lazy val withLocalCharBuffer: LocalStack[LocalCharBuffer]
    Definition Classes
    LocalBufferMixin
  101. final def zeroLengthStatus: ZeroLengthStatus

    Determines, as soon as possible, whether the stream has zero length, or non-zero length.

    Determines, as soon as possible, whether the stream has zero length, or non-zero length.

    Only produces Zero length if the stream is finished, so we know nothing will be added to make it non-zero.

    Starts as Unknown status, transitions to either Zero or NonZero.

    Works even if the streams have been collapsing together as a result of earlier streams having been setFinished.

    Definition Classes
    DataOutputStreamImplMixinDataOutputStream

Inherited from DataOutputStreamImplMixin

Inherited from LocalBufferMixin

Inherited from DataStreamCommonImplMixin

Inherited from DataOutputStream

Inherited from DataStreamCommon

Inherited from DataStreamCommonState

Inherited from AnyRef

Inherited from Any

Ungrouped