FAQ
i'am one may way reading Gzip package of go :

but there is one things i havaen't understand it's the difference between Flush
and Write

Also i didn't understand this sentence :

It is the caller's responsibility to call Close on the WriteCloser when
done. Writes may be buffered and not flushed until Close

who is the caller's ? and what they want to mean by Writes may be buffered
and not flushed until Close?

please help me

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Dave Cheney at Sep 2, 2015 at 10:42 pm
    The caller is your code. You code calls that method (also known as invoking the method)

    Flush is a property of writer implementations that buffer their output. Buffering output means every write call may not result in a corresponding write call to the underlying writer. This can improve performance, but as the underlying writer is invoked less often it may not be immediately obvious that the underlying writer is having a problem (maybe out of disk space, maybe the TCP socket for disconnected).

    The flush method will send any buffered data to the underlying writer unconditional and may expose any error with the underlying writer.

    Flush is invoked by the close method on writers that buffer writes.

    Thanks

    Dave

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • WALID BELRHALMIA at Sep 2, 2015 at 11:01 pm
    @Dave how can i buffer the output of a writer please help me with an
    example

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Ian Lance Taylor at Sep 2, 2015 at 11:56 pm

    On Wed, Sep 2, 2015 at 4:01 PM, WALID BELRHALMIA wrote:
    @Dave how can i buffer the output of a writer please help me with an example
    The gzip code that you are looking at is an example.

    Or, I just typed "go buffer output of writer" into a search engine,
    and the first link was to http://golang.org/pkg/bufio/ . That is
    another example.

    Ian

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • WALID BELRHALMIA at Sep 2, 2015 at 11:09 pm
    @Dave the writer of bufio package implements the buffer for io.writer type
    , But writer of Gzip don't implements a buffer for io.writer it just write
    to the io.writer embeding

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Ian Lance Taylor at Sep 2, 2015 at 11:59 pm

    On Wed, Sep 2, 2015 at 4:09 PM, WALID BELRHALMIA wrote:
    @Dave the writer of bufio package implements the buffer for io.writer type ,
    But writer of Gzip don't implements a buffer for io.writer it just write to
    the io.writer embeding
    It doesn't buffer the output in the same way, but it does buffer the
    output. Look at the Flush method and think about what would happen if
    it were never called.

    Ian

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedSep 2, '15 at 10:15p
activeSep 2, '15 at 11:59p
posts6
users3
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase