Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #10411

Re: Writing to file

From Roedy Green <see_website@mindprod.com.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Writing to file
Date 2011-12-02 01:33 -0800
Organization Canadian Mind Products
Message-ID <im6hd71hha4eorbj4rmoj7ghjgvt595nni@4ax.com> (permalink)
References <e1b7d157-4018-44a7-8176-3a2f308562b8@cu3g2000vbb.googlegroups.com>

Show all headers | View raw


On Wed, 30 Nov 2011 11:31:33 -0800 (PST), sara <sarasara82@gmail.com>
wrote, quoted or indirectly quoted someone who said :

>DataOutputStream dos = new DataOutputStream(fos);
>for (n : N) {
>dos.writeInt(n.id);
>dos.writeFloat(x.floatValue());

See http://mindprod.com/applet/fileio.html

It will generate you code to do this.  Make sure you ask for buffered
if you want speed.

Get rid of Float objects and just use pure float primitives if you
want speed.

There is not much overhead, just flipping the little endian Intel uses
internally  to big endian.

-- 
Roedy Green Canadian Mind Products
http://mindprod.com
For me, the appeal of computer programming is that
even though I am quite a klutz,
I can still produce something, in a sense
perfect, because the computer gives me as many
chances as I please to get it right.
 

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Writing to file sara <sarasara82@gmail.com> - 2011-11-30 11:31 -0800
  Re: Writing to file Lew <lewbloch@gmail.com> - 2011-11-30 14:20 -0800
  Re: Writing to file Roedy Green <see_website@mindprod.com.invalid> - 2011-12-02 01:33 -0800
  Re: Writing to file Arne Vajhøj <arne@vajhoej.dk> - 2011-12-02 19:58 -0500

csiph-web