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


Groups > comp.lang.java.help > #2382

Re: FileOutputStream questions

From Jukka Lahtinen <jtfjdehf@hotmail.com.invalid>
Newsgroups comp.lang.java.help
Subject Re: FileOutputStream questions
Organization N/A
References <p4ejd893hi08mkpjabtfn6mcbemhmuceua@4ax.com>
Message-ID <lvehiehz3i.fsf@saunalahti.fi> (permalink)
Date 2012-12-25 18:32 +0200

Show all headers | View raw


Roedy Green <see_website@mindprod.com.invalid> writes:

> I have just realised I do not understand some basic things about
> unbuffered FileOutputStream.
> I used them in two ways, wrapping in a BufferedOutputStream or
> BufferedWriter, or writing an entire file in one i/o without
> buffering.
> If you write single bytes at a time, will you trigger physical I/O on
> every byte, or is there some small buffer in there anyway?

I suppose that even if you use a non-buffering java class for file
writing, the operating system may still buffer the output. AFAIK, at
least Linux does that.

> I have experimented with flush during file write. The file size stays
> at 0 until I close, at least to DIR. 

The directory entry is probably not fully written or updated before you
close the fle. As long as the file is open for writing, the operating
system does not know wheter you will still be writing to it.

-- 
Jukka Lahtinen

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


Thread

FileOutputStream questions Roedy Green <see_website@mindprod.com.invalid> - 2012-12-25 06:36 -0800
  Re: FileOutputStream questions markspace <markspace@nospam.nospam> - 2012-12-25 07:54 -0800
    Re: FileOutputStream questions Roedy Green <see_website@mindprod.com.invalid> - 2012-12-26 01:30 -0800
  Re: FileOutputStream questions Jukka Lahtinen <jtfjdehf@hotmail.com.invalid> - 2012-12-25 18:32 +0200
  Re: FileOutputStream questions Knute Johnson <nospam@knutejohnson.com> - 2012-12-25 11:45 -0800
    Re: FileOutputStream questions Roedy Green <see_website@mindprod.com.invalid> - 2012-12-26 01:32 -0800
      Re: FileOutputStream questions Knute Johnson <nospam@knutejohnson.com> - 2012-12-26 09:19 -0800
  Re: FileOutputStream questions Roedy Green <see_website@mindprod.com.invalid> - 2012-12-25 13:17 -0800
    Re: FileOutputStream questions Knute Johnson <nospam@knutejohnson.com> - 2012-12-25 14:05 -0800
      Re: FileOutputStream questions Roedy Green <see_website@mindprod.com.invalid> - 2012-12-26 01:35 -0800
      Re: FileOutputStream questions markspace <markspace@nospam.nospam> - 2012-12-26 07:46 -0800
    Re: FileOutputStream questions Stanimir Stamenkov <s7an10@netscape.net> - 2013-01-01 02:36 +0200

csiph-web