Re: Fav. Memory Stream Impl.
On 28.11.2011 14:58, Jan Burse wrote:
Robert Klemme schrieb:
And how do you make library code use your memory stream factory
class? Remember, there will by typically a line like this somewhere
FileInputStream fileIn = new FileInputStream(fileName);
I will replace these constructors. The input streams /
output streams are factored via methods from the
memory stream instance, and not passed as an argument
to other constructors.
And I said you will have to use bytecode manipulation for this in case
of other libraries (i.e. ones which you do not control or have access to
sources to).
From what you write I get the impression that you are hooked into your
idea of using in memory piles of bytes as replacement for temporary
files because it looks like a good idea (and simple to do) on first
sight.
Well it might be a matter of taste what is a
good idea and what not.
In a way, yes. I'd rather say it's a matter of goals which one wants to
achieve. There are means which work well for some ends and not so well
for others. If the goal is clear solutions can often be pretty easy
aligned according to "good" and "not good".
In the present case I am expecting more performance,
since these memory streams will be used in high
frequency for small contents of about 10-50 bytes.
*What* content? Why do you not answer this question? You didn't even
state that you do not want to answer the question (which I could
understand if you do not want to leak out ideas you are working on).
But coming here and asking while at the same time ignoring those who are
willing to help to find a good solution is not a strategy to success.
Regards
robert
--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/