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


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

Re: Easy way to read the contants of a folder/directory and output contents to file?

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.glorb.com!news-out.readnews.com!transit3.readnews.com!s09-11.readnews.com!unm2.readnews.com.POSTED!not-for-mail
X-Trace DXC=o[kVo]gi1:GlhocD2AoRkAk\2KDSF=2@BFV0LA4MIjQKmTIDj6@1WaL^]]CW6JBjaITA`X]=O@ZUNQXAoc\[EG3IE58\`NEoN;@1BI1KGeLIgO4Md=^D^90ZJ20:`FRSgUKO
X-Complaints-To killthespammer@usenetmonster.com
From "Thee Chicago Wolf [MVP]" <.@.>
Newsgroups comp.lang.java.help
Subject Re: Easy way to read the contants of a folder/directory and output contents to file?
Date Mon, 12 Dec 2011 09:51:50 -0600
Organization .
Reply-To .
Message-ID <5n8ce7pgpk3ebv71sgs10i8pie2vtlhdpa@4ax.com> (permalink)
References <e5rae71q7jppj0ms8jn0sc0qp636gn3csj@4ax.com> <nospam-4A7111.23085411122011@news.aioe.org> <lc4ce71958l9ddrl1ukvbi87e4j6l97ta4@4ax.com> <9kmij4FsduU1@mid.individual.net> <s96ce79sq980me16uu6s37f89bt0jb602f@4ax.com> <9kmlr3Fmm1U1@mid.individual.net>
X-Newsreader Forte Agent 6.00/32.1186
X-No-Archive yes
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
Lines 43
NNTP-Posting-Host c96e5d06.newsreader.readnews.com
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.help:1438

Show key headers only | View raw


>On 12/12/11 15:12, Thee Chicago Wolf [MVP] wrote:
>>> On 12/12/11 14:42, Thee Chicago Wolf [MVP] wrote:
>>>
>>>> outFile.write(String.valueOf(list[i]+"\n"));
>>>
>>> Do you something against the PrintWriter.println(String) method?
>>
>> Well, in some code I'd written previous, I used .write instead of
>> .println. When I actually tried .println, the output I got was as
>> such:
>>
>> file1.txt
>> <space>
>> file2.txt
>> <space>
>> file3.txt
>> <space>
>> <space>
>>
>> Not so pretty right?
>
>> when using .write, I get:
>>
>> file1.txt
>> file2.txt
>> file3.txt
>> <space>
>>
>> Which is exactly what I want. I asked this of another person as well.
>> I naturally though println would give me nice clean output as in my
>> second example. But it didn't. When I used .write, it did. So, I'm
>> sticking with .write. Do you have any idea why println would give me
>> such spaced output?
>
>If you append a "\n" to the filename that is what you'll get. println() 
>prints a line of output with a line terminator. Hence there is no need 
>to append a "\n". That saves both processing time (concatenating Strings 
>is relatively slow) and unnecessary coding.

Got it and yes, it is now obvious to me. I'll fix it up. Thanks for
that.

- Thee Chicago Wolf [MVP]

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


Thread

Easy way to read the contants of a folder/directory and output contents to file? "Thee Chicago Wolf (MVP)" <.@.> - 2011-12-11 21:06 -0600
  Re: Easy way to read the contants of a folder/directory and output contents to file? "John B. Matthews" <nospam@nospam.invalid> - 2011-12-11 23:08 -0500
    Re: Easy way to read the contants of a folder/directory and output contents to file? "Thee Chicago Wolf [MVP]" <.@.> - 2011-12-12 08:42 -0600
      Re: Easy way to read the contants of a folder/directory and output contents to file? Nigel Wade <nmw-news@ion.le.ac.uk> - 2011-12-12 14:49 +0000
        Re: Easy way to read the contants of a folder/directory and output contents to file? "Thee Chicago Wolf [MVP]" <.@.> - 2011-12-12 09:12 -0600
          Re: Easy way to read the contants of a folder/directory and output contents to file? Nigel Wade <nmw-news@ion.le.ac.uk> - 2011-12-12 15:44 +0000
            Re: Easy way to read the contants of a folder/directory and output contents to file? "Thee Chicago Wolf [MVP]" <.@.> - 2011-12-12 09:51 -0600
      Re: Easy way to read the contants of a folder/directory and output contents to file? Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-12-12 10:03 -0500
        Re: Easy way to read the contants of a folder/directory and output contents to file? "Thee Chicago Wolf [MVP]" <.@.> - 2011-12-12 09:15 -0600
          Re: Easy way to read the contants of a folder/directory and output contents to file? Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-12-12 10:45 -0500
            Re: Easy way to read the contants of a folder/directory and output contents to file? "Thee Chicago Wolf [MVP]" <.@.> - 2011-12-12 09:52 -0600
  Re: Easy way to read the contants of a folder/directory and output contents to file? Roedy Green <see_website@mindprod.com.invalid> - 2011-12-12 01:02 -0800
    Re: Easy way to read the contants of a folder/directory and output contents to file? "Thee Chicago Wolf [MVP]" <.@.> - 2011-12-12 09:19 -0600
  Re: Easy way to read the contants of a folder/directory and output contents to file? "Thee Chicago Wolf [MVP]" <.@.> - 2011-12-12 09:08 -0600
    Re: Easy way to read the contants of a folder/directory and output contents to file? Jukka Lahtinen <jtfjdehf@hotmail.com.invalid> - 2011-12-12 18:24 +0200
      Re: Easy way to read the contants of a folder/directory and output contents to file? "Thee Chicago Wolf [MVP]" <.@.> - 2011-12-12 10:54 -0600
        Re: Easy way to read the contants of a folder/directory and output contents to file? Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-12-12 12:40 -0500
          Re: Easy way to read the contants of a folder/directory and output contents to file? "Thee Chicago Wolf [MVP]" <.@.> - 2011-12-12 12:03 -0600
          Re: Easy way to read the contants of a folder/directory and output contents to file? Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-12-12 13:04 -0500

csiph-web