olabusayoT commented on code in PR #1479: URL: https://github.com/apache/daffodil/pull/1479#discussion_r2074090443
########## daffodil-runtime1/src/main/java/org/apache/daffodil/api/InputSourceDataInputStream.java: ########## @@ -15,89 +15,71 @@ * limitations under the License. */ -package org.apache.daffodil.japi.io +package org.apache.daffodil.api; -import java.io.InputStream -import java.nio.ByteBuffer +import java.io.Closeable; +import java.io.IOException; -import org.apache.daffodil.io.{ InputSourceDataInputStream => SInputSourceDataInputStream } /** * Provides Daffodil with byte data from an InputStream, ByteBuffer, or byte * Array. - * + * <p> * 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: - * - * {{{ + * <p> + * {@code * Path path = Paths.get(file); * FileInputStream fis = Files.newInputStream(path); * InputSourceDataInputStream input = InputSourceDataInputStream(fis); - * }}} - * + * } + * <p> * 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. - * - * {{{ + * <p> + * {@code * Path path = Paths.get(file); * long size = Files.size(path); * FileChannel fc = FileChannel.open(path, StandardOpenOption.READ); * ByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, size); * fc.close(); * InputSourceDataInputStream input = new InputSourceDataInputStream(bb); - * }}} + * } */ -class InputSourceDataInputStream private[japi] ( - private[japi] val dis: SInputSourceDataInputStream -) extends java.io.Closeable { - - /** - * Create an InputSourceDataInputStream from a java.io.InputStream - */ - def this(is: InputStream) = this(SInputSourceDataInputStream(is)) - - /** - * Create an InputSourceDataInputStream from a java.nio.ByteBuffer - */ - def this(bb: ByteBuffer) = this(SInputSourceDataInputStream(bb)) - - /** - * Create an InputSourceDataInputStream from a byte array - */ - def this(arr: Array[Byte]) = this(SInputSourceDataInputStream(arr)) - +public abstract class InputSourceDataInputStream implements Closeable { Review Comment: This is the comment associated with that class in the original japi/sapi /* * The below class is empty and is not ever actually used. It is just a place * holder. Whenever the Java API uses it, it is translated to the appropriate * Scala debugger runner. It is marked final so that it cannot be extended, * since the Scala pattern matcher would still match and use the equivalent * Scala trace runner and lose any added functionality. One must extend the * DebuggerRunner to create their own debugger runner. */ As such, I've moved it and renamed it to InteractiveTraceDebuggerRunner and it is final and only used for pattern matching -- 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. To unsubscribe, e-mail: commits-unsubscr...@daffodil.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org