Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Robert Klemme Newsgroups: comp.lang.java.programmer Subject: Re: Fav. Memory Stream Impl. Date: Mon, 28 Nov 2011 19:52:40 +0100 Lines: 46 Message-ID: <9ji3juFomgU1@mid.individual.net> References: <4ed0101b$0$282$14726298@news.sunsite.dk> <9jflnkFnrgU1@mid.individual.net> <9jgqmvFjc4U1@mid.individual.net> <6b19df45-6141-45f0-ae2e-8ff30ece4928@y42g2000yqh.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net qJZRXJj3ALowErfBtXO2wAQ2g/2L7a3zS0u+uuwMuJKrRGlwY= Cancel-Lock: sha1:WlaWRjaYiMyfuf/JeyrJ8NPfVTY= User-Agent: Mozilla/5.0 (Windows NT 6.0; WOW64; rv:8.0) Gecko/20111105 Thunderbird/8.0 In-Reply-To: Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:10301 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/