Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
I was challenged by the following comment in RereadableInputStream:
// TODO: At some point it would be better to replace the current approach // (specifying the above) with more automated behavior. The stream could // keep the original stream open until EOF was reached. For example, if: // // the original stream is 10 bytes, and // only 2 bytes are read on the first pass // rewind() is called // 5 bytes are read // // In this case, this instance gets the first 2 from its store, // and the next 3 from the original stream, saving those additional 3 // bytes in the store. In this way, only the maximum number of bytes // ever needed must be saved in the store; unused bytes are never read. // The original stream is closed when EOF is reached, or when close() // is called, whichever comes first. Using this approach eliminates // the need to specify the flag (though makes implementation more complex).
Challenge accepted