The Artima Developer Community
Sponsored Link

Java Answers Forum
need help with classes

2 replies on 1 page. Most recent reply: Jan 28, 2003 2:00 AM by Matt Gerrans

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
Janus Knudsen

Posts: 1
Nickname: janus007
Registered: Jan, 2003

need help with classes Posted: Jan 15, 2003 2:49 PM
Reply to this message Reply
Advertisement
I am in the process of making a filereader for listing files and their sizes from a particular directory. All the files that is read is going to be saved in a single textfile!!. Some sort of a combine all files into one big, if you know what i mean :O)


Needed properties:
getAllFilesInDir (and also subdir)
totalSizeOfDir (all files)
fileSize (for a single file)
setSourceDir (path to where filereader is reading)
setDestinationFile (path to store all files read)
numberOfFilesRead
totalKBProcessed

I dont need help with methods, all I want to understand is the classes... superclass, subclass etc...

Could somebody please point me in the right direction??


Tj

Posts: 7
Nickname: tj
Registered: Jan, 2003

Re: need help with classes Posted: Jan 27, 2003 11:22 PM
Reply to this message Reply
It doesn't look like object-oriented programming enters at all into your problem. You just input a list of filenames, and output a string.

Why not just declare all functions "static" and stick them in some skeleton class? Just make sure you separate the duties of reading files away from doing the text processing.

BTW, I don't understand why you care about the filesizes, unless you're doing something else you haven't mentioned.

Hope this helps.

Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: need help with classes Posted: Jan 28, 2003 2:00 AM
Reply to this message Reply
If you mean by "output a string" to return a String, that might be a memory problem on a big disk with a lot of files. It probably would be safer to open a stream, run through all the files and dump each to the stream.

By the way, this kind of task would be just a few lines of code in Python or Perl (or even shell script), but will probably be a lot more in Java.

Flat View: This topic has 2 replies on 1 page
Topic: How to break a string to multiple lines Previous Topic   Next Topic Topic: Session handlers

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use