Github user aarondav commented on a diff in the pull request:
https://github.com/apache/spark/pull/266#discussion_r11320447
--- Diff:
streaming/src/main/scala/org/apache/spark/streaming/util/RawTextSender.scala ---
@@ -45,16 +43,15 @@ object RawTextSender extends Logging {
// Repeat the input data multiple times to fill in a buffer
val lines = Source.fromFile(file).getLines().toArray
- val bufferStream = new FastByteArrayOutputStream(blockSize + 1000)
+ val bufferStream = new ByteArrayOutputStream(blockSize + 1000)
val ser = new KryoSerializer(new SparkConf()).newInstance()
val serStream = ser.serializeStream(bufferStream)
var i = 0
- while (bufferStream.position < blockSize) {
+ while (bufferStream.size < blockSize) {
--- End diff --
The
[docs](http://docs.oracle.com/javase/6/docs/api/java/io/ByteArrayOutputStream.html#size())
seem to indicate that it returns the number of valid bytes in the stream
(which is what we want), and the
[source](http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/io/ByteArrayOutputStream.java#160)
seems to verify this claim.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---