hp1res / io-tools

Automatically exported from code.google.com/p/io-tools
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

InputStreamFromOutputStream#read(byte[] b) does not trigger producing #37

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. create an instance of InputStreamFromOutputStream (overriding produce())
InputStreamFromOutputStream<...> stream = new 
InputStreamFromOutputStream<...>() {...}
2. read from stream
byte[] buffer = new byte[size];
stream.read(buffer);

What is the expected output? What do you see instead?
Result: The buffer is empty. 
Expected: The content of the produce() method call

What version of the product are you using? On what operating system?
v 1.2.14

Please provide any additional information below.
consider overriding read(byte[] b) in InputStreamFromOutputStream:

    /** {@inheritDoc} */
    @Override
    public final int read(byte[] b) throws IOException {
        checkInitialized();
        final int result = super.read(b);
        if (result < 0) {
            checkException();
        }
        return result;
    }

Original issue reported on code.google.com by fschma...@bandwidth.com on 16 May 2014 at 6:54