🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #240

Writing plain text to file

#240
From: Raul Lorenzo
Date: Mon, 06 Mar 2006 11:19
25 lines
1347 bytes
Hi,

I have this piece of code to write a String to a file:

static public void setContents(File aFile, String aContents) throws
FileNotFoundException, IOException
	{
	Writer output = null;
	try
		{
		output = new BufferedWriter( new FileWriter(aFile) );
		output.write( aContents );
		}
		finally
			{
			if (output != null)
				output.close();
			}
	}
	
But the file, looks like: (Some problem with \n) (How to solve it)



nullu0Inicializando REMu0Inicializando IU Pluginu0Ini
Technical Details
Message-ID: <440c19e7$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newshub.sdsu.edu!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: f74b3,7427db691bf1ff33,start
X-Google-Attributes: gidf74b3,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Mon, 06 Mar 2006 12:19:23 +0100
From: Raul Lorenzo <rlorenb@agalisa.es>
User-Agent: Thunderbird 1.5 (Windows/20051201)
MIME-Version: 1.0
Newsgroups: borland.public.jbuilder.java.language
Subject: Writing plain text to file
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 83.60.227.194
Message-ID: <440c19e7$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1141643751 83.60.227.194 (6 Mar 2006 03:15:51 -0700)
Lines: 25
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newshub.sdsu.edu!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail