What does ZipEntry object represent (contain)? A whole file, including actual data or...?

B

beginner16

hello

1)
Does ZipEntry object represent the whole file ( including actual data
written in a file ) or does it contain just a description of a file
( name of the file, its length etc ), but not actual data?


2) Both BufferedWriter and OutputStreamWriter have writeLine() metods.
Is there any difference between the two methods? Perhaps writeLine()
in BufferedWriter writes the whole line at once while the other method
doesn't?
If so, how is it able to write the whole line at once?

thank you

cheers
 
L

Lothar Kimmeringer

beginner16 said:
1)
Does ZipEntry object represent the whole file ( including actual data
written in a file ) or does it contain just a description of a file
( name of the file, its length etc ), but not actual data?

You still read from the stream, so the ZipEntry can be seen
only as representation.
2) Both BufferedWriter and OutputStreamWriter have writeLine() metods.
Is there any difference between the two methods?

The functionality is the same, System.getProperty("line.separator")
will be written to the underyling writer/stream.
Perhaps writeLine()
in BufferedWriter writes the whole line at once while the other method
doesn't?

That would be flushing and has nothing to do with the functionality
of writeLine(). BufferedWriter only flushes the buffer if the buffer
is full or is told so explicitly. OutputStreamWriter is not buffering
anything so the line-separator will be written to the underlying
stream immediately.
If so, how is it able to write the whole line at once?

Use PrintWriter.println and initialize the Writer with
autoflush being set to true.

Before asking more questions try reading the Javadocs first. The
aforementioned writers are quite good explained there.


Regards, Lothar
--
Lothar Kimmeringer E-Mail: (e-mail address removed)
PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81)

Always remember: The answer is forty-two, there can only be wrong
questions!
 
A

A. Bolmarcich

hello

1)
Does ZipEntry object represent the whole file ( including actual data
written in a file ) or does it contain just a description of a file
( name of the file, its length etc ), but not actual data?

A ZipEntry object does not directly refer to the data stored for the
entry. The data stored for a ZipEntry can be read using the InputStream
returned by the getInputStream(ZipEntry) method of ZipFile.
2) Both BufferedWriter and OutputStreamWriter have writeLine() metods.
Is there any difference between the two methods? Perhaps writeLine()
in BufferedWriter writes the whole line at once while the other method
doesn't?
If so, how is it able to write the whole line at once?

As far as I can tell neither java.io.BufferedWriter nor
java.io_OutputStreamWriter (nor any other standard java class) have a
writeLine method.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top