J
Jan Burse
Robert said:Basically if you want to use other libraries which depend on java.io to
open files you have little chance to smuggle a "memory stream" in there
without going through the effort to modify byte code of classes.
No, I don't think that the above claim is right. Look see what
is written for the class InputStream:
This abstract class is the superclass of
all classes representing an input
stream of bytes.
http://docs.oracle.com/javase/1.4.2/docs/api/java/io/InputStream.html
So with proper OO I could implement:
class MemoryStream {
InputStream createInput();
}
class MemoryInput extens InputStream {
...
}
The factory method could return a MemoryInput instance
from a MemoryStream instance. Similarly I could
provide OutputStrem createOutput etc..
The MemoryStream would be not the first stream that
has been created outside of java.lang via proper OO.
Think for example of the request and respons streams
of a web server. They are also made like this.
Bye