class InputSourceDataInputStream extends Closeable
Provides Daffodil with byte data from an InputStream, ByteBuffer, or byte Array.
Note that the InputStream variant has potential overhead due to streaming capabilities and support for files greater than 2GB. In some cases, better performance might come from using the byte array or ByteBuffer variants instead. For example, if your data is already in a byte array, one should use the Array[Byte] or ByteBuffer variants instead of wrapping it in a ByteArrayInputStream. As another example, instead of using a FileInputStream like this:
val path = Paths.get(file) val fis = Files.newInputStream(path) val input = InputSourceDataInputStream(fis)
You might consider mapping the file to a MappedByteBuffer like below, keeping in mind that MappedByteBuffers have size limitations and potentially different performance characteristics depending on the file size and system--it maybe not always be faster than above.
val path = Paths.get(file) val size = Files.size(path) val fc = FileChannel.open(path, StandardOpenOption.READ) val bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, size) fc.close() val input = InputSourceDataInputStream(bb)
- Alphabetic
- By Inheritance
- InputSourceDataInputStream
- Closeable
- AutoCloseable
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
InputSourceDataInputStream(arr: Array[Byte])
Create an InputSourceDataInputStream from a byte array
-
new
InputSourceDataInputStream(bb: ByteBuffer)
Create an InputSourceDataInputStream from a java.nio.ByteBuffer
-
new
InputSourceDataInputStream(is: InputStream)
Create an InputSourceDataInputStream from a java.io.InputStream
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
def
close(): Unit
Closes the underlying resource associated with this object.
Closes the underlying resource associated with this object.
Once the resource is closed, any subsequent operations on the resource may throw an
IOException
.- Definition Classes
- InputSourceDataInputStream → Closeable → AutoCloseable
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hasData(): Boolean
Returns true if the input stream has at least 1 bit of data.
Returns true if the input stream has at least 1 bit of data.
Does not advance the position.
Returns true immediately if the input stream has available data that has not yet been consumed.
On a network input stream, this may block to determine if the stream contains data or is at end-of-data.
This is used when parsing multiple elements from a stream to see if there is data or not before calling parse().
It may also be used after a parse() operation that is intended to consume the entire data stream (such as for a file) to determine if all data has been consumed or some data is left-over.
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
This is the documentation for the Apache Daffodil Scala API.
Package structure
org.apache.daffodil.sapi - Provides the classes necessary to compile DFDL schemas, parse and unparse files using the compiled objects, and retrieve results and parsing diagnostics
org.apache.daffodil.udf - Provides the classes necessary to create User Defined Functions to extend the DFDL expression language
org.apache.daffodil.runtime1.layers.api - Provides the classes necessary to create custom Layer extensions to DFDL.