Android implementation of PipedOutputStream
write(byte[] buffer, int offset, int count)
implemented in terms of write (byte oneByte). More specifically, PipedOutputStream
write(byte[] buffer, int offset, int count)
implemented by looping bytes [] and calling write (byte oneByte) for each byte. See this .
Executing this method results in a received PipedInputStream call for each byte. This produces results in notifyAll, which wakes the reader and reads it. This way you get a lot of bytes.
I see that this is the correct implementation, but slow. Maybe there is some kind of Java convention that makes this wrong? Since array entry in PipedOutputStream now alternates with notification in PipedInputStream.
write [abc] causes the record (a) to notify the record (b) to notify the record (c) to notify.
source
share