c

org.apache.daffodil.io

BucketingInputSource

class BucketingInputSource extends InputSource

Implements the InputSource interface, reading data from a generic java.io.InputStream and storing the data in buckets of a defined size. Buckets are freed when no "locks" exist inside the bucket to minimize memory usage. Note that "locks" in this sense are the InputSource locks on bytePosition and are not about syncrhonization. This more of a reference count, counting buckets to determine which buckets are no longer needed and can be freed when the reference count goes to zero.

Linear Supertypes
InputSource, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. BucketingInputSource
  2. InputSource
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new BucketingInputSource(inputStream: InputStream, bucketSize: Int = 1 << 13, maxCacheSizeInBytes: Int = 256 * (1 << 20))

    inputStream

    the java.io.Inputstream to read data from

    bucketSize

    the size of each individual bucket

    maxCacheSizeInBytes

    the max memory allowed to be used for bucket storage (num buckets * bucketSize)

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 _isValid: Boolean
    Attributes
    protected
    Definition Classes
    InputSource
  5. def areBytesAvailable(nBytes: Long): Boolean

    Determines whether the input stream has nBytes more bytes available starting at the current byte position.

    Determines whether the input stream has nBytes more bytes available starting at the current byte position. Read bytes are cached in buckets. Blocks until either nBytes are known to be available or EOF is reached. Does not advance the current byte position.

    nBytes

    the number of bytes to determine if are available

    returns

    true if nBytes are available, false otherwise

    Definition Classes
    BucketingInputSourceInputSource
  6. final def areDebugging: Boolean
    Definition Classes
    InputSource
  7. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  8. def bytesAvailable(): Long

    Calculate how many bytes are currently buffered starting from the current position

    Calculate how many bytes are currently buffered starting from the current position

    Definition Classes
    BucketingInputSourceInputSource
  9. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  10. def compact(): Unit

    This should be called when at the end of a parse when all marks have been released, or just called periodically to ensure the size of the buckets arraybuffer does not grow too big.

    This should be called when at the end of a parse when all marks have been released, or just called periodically to ensure the size of the buckets arraybuffer does not grow too big. This will move all existing buckets to the front of the buckets ArrayBuffer and update offsets accordingly. This way, there are not a bunch of null empty buckets at the front of the buckets array taking up space.

    Definition Classes
    BucketingInputSourceInputSource
  11. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  12. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  13. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  14. def get(dest: Array[Byte], off: Int, len: Int): Boolean

    Return a byte array with data from the current byte position.

    Return a byte array with data from the current byte position. Stores the next len bytes of data in dest starting at index off. Returns true if len bytes are available, false otherwise and writes nothing to dest.

    returns

    true if len bytes are available and written to the dest array, false otherwise

    Definition Classes
    BucketingInputSourceInputSource
  15. def get(): Int

    Return a single byte at the current byte position.

    Return a single byte at the current byte position. Increments curBytePosition0b if successful. The Byte is return as an integer in the range 0 to 255. Returns -1 if EOF is reached.

    returns

    the byte at the current byte position if it exists, or -1 if EOF is reached.

    Definition Classes
    BucketingInputSourceInputSource
  16. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  17. def hasReachedEndOfData: Boolean

    Determine if the InputSource has encountered the end-of-data.

    Determine if the InputSource has encountered the end-of-data.

    This does NOT perform a read operation (which would be blocking), but just answers the question of whether prior read operations in fact encountered the -1 indicating end-of-data

    Definition Classes
    BucketingInputSourceInputSource
  18. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  19. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  20. final def isValid: Boolean
    Definition Classes
    InputSource
  21. def lockPosition(bytePos0b: Long): Unit

    Set the specified byte position as a location that that one may want to call setPosition in the future.

    Set the specified byte position as a location that that one may want to call setPosition in the future. This is essentially setting a mark in the data that can be reset back to later. Implementations are allowed to free any bytes before a locked byte position. Any bytes after a locked position cannot be freed until that lock is release.

    Note that this "lock" has nothing to do with synchronization, but behaves more like marks that must be accessable until released.

    bytePos0b

    the byte position to lock

    Definition Classes
    BucketingInputSourceInputSource
  22. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  23. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  24. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  25. def position(bytePos0b: Long): Unit

    Set the current byte position, using zero-based indexing

    Set the current byte position, using zero-based indexing

    bytPos0b cannot be greater than the most recent read data. In other words, this can only be used to move backwards in data.

    bytePos0b

    the new current byte position

    Definition Classes
    BucketingInputSourceInputSource
  26. def position(): Long

    Get the current byte position, using zero-based indexing

    Get the current byte position, using zero-based indexing

    returns

    the current byte position

    Definition Classes
    BucketingInputSourceInputSource
  27. def releasePosition(bytePos0b: Long): Unit

    Release a previously locked byte position, allowing the implementation to free any unlocked bytes.

    Release a previously locked byte position, allowing the implementation to free any unlocked bytes.

    bytePos0b

    the byte position to release

    Definition Classes
    BucketingInputSourceInputSource
  28. final def setDebugging(setting: Boolean): Unit
    Definition Classes
    InputSource
  29. final def setInvalid(): Unit
    Definition Classes
    InputSource
  30. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  31. def toString(): String
    Definition Classes
    AnyRef → Any
  32. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  33. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  34. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()

Inherited from InputSource

Inherited from AnyRef

Inherited from Any

Ungrouped