[ https://issues.apache.org/jira/browse/SPARK-3442?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14125948#comment-14125948 ]
Sean Owen commented on SPARK-3442: ---------------------------------- This exists in Guava as LimitInputStream until Guava 14, and as ByteStreams.limit() from 14 onwards: https://code.google.com/p/guava-libraries/source/browse/guava/src/com/google/common/io/LimitInputStream.java?spec=svn08d3526fc19293cf099e0c50dbf3bbc915f2e3f2&r=08d3526fc19293cf099e0c50dbf3bbc915f2e3f2 http://docs.guava-libraries.googlecode.com/git-history/v14.0/javadoc/com/google/common/io/ByteStreams.html#limit(java.io.InputStream, long) It would be nice to reuse but you can see the version problem there. At least, maybe something that can be lifted and adapted. > Create LengthBoundedInputStream > ------------------------------- > > Key: SPARK-3442 > URL: https://issues.apache.org/jira/browse/SPARK-3442 > Project: Spark > Issue Type: Sub-task > Components: Shuffle, Spark Core > Reporter: Reynold Xin > Assignee: Reynold Xin > > To create a LengthBoundedInputStream, which is an InputStream decorator that > limits the number of bytes returned from an underlying InputStream. > This can be used to create an InputStream directly from a segment of a file > (FileInputStream always reads till EOF). -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org