D
Derek Lewis
I've been experimenting with some modifications to WEBrick, and came
across an interesting little problem I'm not sure how to solve.
I've got a method with a signature something like this:
def appendTo( someData, moreData)
end
If both someData and moreData are Strings, then the method is really easy:
return someData + moreData
The problem is when either (or both) someData and moreData are IOs. I don't
want to read all the lines from the IOs, into a string, and append to
that. It's concievable that the data from the IO may be larger than
memory. What I'd like to do is return an IO from the method, that, when
read from, will return the data from someData, and then the data from
moreData.
Basically what I want to do is create a subclass of IO, maybe called
ArrayIO, that maintains an array of Strings and IO objects, and
progresses through them as it is read from.
Is there a particular subset of the methods in IO that I can override in
an IO subclass, and be confident that my subclass will work?
--
Derek Lewis
===================================================================
Java Web-Application Developer
Email : (e-mail address removed)
Cellular : 778.898.5825
Website : http://www.lewisd.com
"If you've got a 5000-line JSP page that has "all in one" support
for three input forms and four follow-up screens, all controlled
by "if" statements in scriptlets, well ... please don't show it
to me . Its almost dinner time, and I don't want to lose my
appetite ."
- Craig R. McClanahan
across an interesting little problem I'm not sure how to solve.
I've got a method with a signature something like this:
def appendTo( someData, moreData)
end
If both someData and moreData are Strings, then the method is really easy:
return someData + moreData
The problem is when either (or both) someData and moreData are IOs. I don't
want to read all the lines from the IOs, into a string, and append to
that. It's concievable that the data from the IO may be larger than
memory. What I'd like to do is return an IO from the method, that, when
read from, will return the data from someData, and then the data from
moreData.
Basically what I want to do is create a subclass of IO, maybe called
ArrayIO, that maintains an array of Strings and IO objects, and
progresses through them as it is read from.
Is there a particular subset of the methods in IO that I can override in
an IO subclass, and be confident that my subclass will work?
--
Derek Lewis
===================================================================
Java Web-Application Developer
Email : (e-mail address removed)
Cellular : 778.898.5825
Website : http://www.lewisd.com
"If you've got a 5000-line JSP page that has "all in one" support
for three input forms and four follow-up screens, all controlled
by "if" statements in scriptlets, well ... please don't show it
to me . Its almost dinner time, and I don't want to lose my
appetite ."
- Craig R. McClanahan