java.io.FileOutputStream misbehavior

From: witichis (gwitichis_at_hotmail.com)
Date: 02/06/04


Date: 6 Feb 2004 02:24:06 -0800

Hello,

is it right that when writing a file, java.io.FileOutputStream decides
if
one or two byte get written per char?
For example you save a String with about 40kbyte into a file.
The size on disk is 40k.
When putting a single umlaut in the String, the filesize doubles
because
sun jre 1.4.2-b28 is writing unicode (two bytes per character) into
the file. Plus "FFFE" as file preamble.

How can this behavior be avoided and let the Stream always write
single bytes per char?

regs
Witi



Relevant Pages

  • Re: Commenting source code is for amateurs
    ... Professionals also use short paragraphs and white space when writing;-) ... Architectural & e-Business Consulting -- Software Development ... >> ' This is my function to count english words in your string ... ' to check every char in your string s ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Null terminated strings: bad or good?
    ... char* data; ... Ease of IO (writing to/fro disk files, ... The writing from a string can be done ...
    (comp.lang.c)
  • Re: Null terminated strings: bad or good?
    ... char* data; ... Ease of IO (writing to/fro disk files, ... The writing from a string can be done ...
    (comp.lang.c)
  • Re: how to convert char* to File *
    ... I have a long string in char * and want to convert it to a File * ... "Debugging is twice as hard as writing the code in the first place. ... not smart enough to debug it." ...
    (comp.lang.c)
  • [PATCH 09/21] perf: rewire generic library stuff, p5
    ... +int eprintf(int level, const char *fmt, ...) ... * Helper function for splitting a string into an argv-like array. ... +static int count_argc(const char *str) ...
    (Linux-Kernel)