aliocrlib/src/main/java/com/lib/aliocr/utils/stream/ByteArrayOutputStream.java
/**
     * Gets the current contents of this byte stream as a Input Stream. The
     * returned stream is backed by buffers of <code>this</code> stream,
     * avoiding memory allocation and copy, thus saving space and time.<br>
     * 
     * @return the current contents of this output stream.
     * @see java.io.ByteArrayOutputStream#toByteArray()
     * @see #reset()
     * @since 2.0
     */
Gets the current contents of this byte stream as a Input Stream. The
returned stream is backed by buffers of this stream,
avoiding memory allocation and copy, thus saving space and time.

@return the current contents of this output stream.
Gets the current contents of this byte stream as a Input Stream . The returned stream is backed by buffers of this stream avoiding memory allocation and copy thus saving space and time . @return the current contents of this output stream .
private InputStream toBufferedInputStream() {
        int remaining = count;
        if (remaining == 0) {
            return new ClosedInputStream();
        }
        List<ByteArrayInputStream> list = new ArrayList<>(buffers.size());
        for (byte[] buf : buffers) {
            int c = Math.min(buf.length, remaining);
            list.add(new ByteArrayInputStream(buf, 0, c));
            remaining -= c;
            if (remaining == 0) {
                break;
            }
        }
        return new SequenceInputStream(Collections.enumeration(list));
    }
private InputStream toBufferedInputStream ( ) { int remaining = count ; if ( remaining == 0 ) { return new ClosedInputStream ( ) ; } List < ByteArrayInputStream > list = new ArrayList < > ( buffers . size ( ) ) ; for ( byte [ ] buf : buffers ) { int c = Math . min ( buf . length , remaining ) ; list . add ( new ByteArrayInputStream ( buf , 0 , c ) ) ; remaining -= c ; if ( remaining == 0 ) { break ; } } return new SequenceInputStream ( Collections . enumeration ( list ) ) ; }
Gets the current contents of this byte stream as a Input Stream.
Gets the current contents of this byte stream as a Input Stream .