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

Discussion in 'Java' started by beginner16, Aug 1, 2007.

  1. beginner16

    beginner16 Guest

    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
     
    beginner16, Aug 1, 2007
    #1
    1. Advertising

  2. beginner16 wrote:

    > 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:
    PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81)

    Always remember: The answer is forty-two, there can only be wrong
    questions!
     
    Lothar Kimmeringer, Aug 1, 2007
    #2
    1. Advertising

  3. On 2007-08-01, beginner16 <> wrote:
    > 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.
     
    A. Bolmarcich, Aug 1, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Roedy Green

    ZipEntry peculiarity

    Roedy Green, Sep 14, 2003, in forum: Java
    Replies:
    2
    Views:
    814
    Roedy Green
    Sep 15, 2003
  2. Replies:
    5
    Views:
    1,641
    Chris Uppal
    Nov 19, 2005
  3. Replies:
    3
    Views:
    432
    Tris Orendorff
    May 17, 2008
  4. Roger Pack
    Replies:
    3
    Views:
    168
    Roger Pack
    Sep 28, 2010
  5. Jason Carlton
    Replies:
    11
    Views:
    253
    Dr J R Stockton
    Dec 8, 2009
Loading...

Share This Page