Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail From: Jan Burse Newsgroups: comp.lang.java.programmer Subject: Re: Fav. Memory Stream Impl. Date: Mon, 28 Nov 2011 14:58:43 +0100 Organization: albasani.net Lines: 28 Message-ID: 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: news.albasani.net PsoOFrZqUPrxvjsKO6zCnB3k2QOW79j/EFuUmQmWh4xS3zBDQAwRZ9flCfOPNiEjbkEbxrjmDTiHU4dqGnL2CIUdvFXZPz/Tri4GKNBF4xmTPFO13sV6v7IaeA1IyTbx NNTP-Posting-Date: Mon, 28 Nov 2011 13:58:44 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="UI4nrHXCzmCEZeHLcWXESTz88NebUT1ootY4nGOd3v50UIRk6jDcu0NT6NnGhuf6CtWwtYgOEGVcut+tKiEYHxf7cSf2+ncEUD1bJ2GTzm8Truq2AQu80Jpp0bHPxPkt"; mail-complaints-to="abuse@albasani.net" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0.1) Gecko/20111121 Firefox/8.0.1 SeaMonkey/2.5 In-Reply-To: <6b19df45-6141-45f0-ae2e-8ff30ece4928@y42g2000yqh.googlegroups.com> Cancel-Lock: sha1:LYHMJNMRwoCb+MhlUj1zh73cSqY= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:10291 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. > 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 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. Maybe a part of Google Protocol Buffers could do: http://code.google.com/intl/de-DE/apis/protocolbuffers/docs/reference/java/index.html They have newInput() and newOutput(). Have to check. Bye