github.com/graybobo/golang.org-package-offline-cache@v0.0.0-20200626051047-6608995c132f/x/talks/2012/chat/support/defs.go (about)

     1  // +build OMIT
     2  
     3  package main
     4  
     5  func Fprintln(w io.Writer, a ...interface{}) (n int, err error)
     6  
     7  // Writer is the interface that wraps the basic Write method.
     8  //
     9  // Write writes len(p) bytes from p to the underlying data stream. It
    10  // returns the number of bytes written from p (0 <= n <= len(p)) and any
    11  // error encountered that caused the write to stop early. Write must return
    12  // a non-nil error if it returns n < len(p).
    13  type Writer interface {
    14  	Write(p []byte) (n int, err error)
    15  }
    16  
    17  // Reader is the interface that wraps the basic Read method.
    18  //
    19  // Read reads up to len(p) bytes into p.  It returns the number of bytes
    20  // read (0 <= n <= len(p)) and any error encountered.  Even if Read
    21  // returns n < len(p), it may use all of p as scratch space during the call.
    22  // If some data is available but not len(p) bytes, Read conventionally
    23  // returns what is available instead of waiting for more.
    24  //
    25  // When Read encounters an error or end-of-file condition after
    26  // successfully reading n > 0 bytes, it returns the number of
    27  // bytes read.  It may return the (non-nil) error from the same call
    28  // or return the error (and n == 0) from a subsequent call.
    29  // An instance of this general case is that a Reader returning
    30  // a non-zero number of bytes at the end of the input stream may
    31  // return either err == EOF or err == nil.  The next Read should
    32  // return 0, EOF regardless.
    33  //
    34  // Callers should always process the n > 0 bytes returned before
    35  // considering the error err.  Doing so correctly handles I/O errors
    36  // that happen after reading some bytes and also both of the
    37  // allowed EOF behaviors.
    38  type Reader interface {
    39  	Read(p []byte) (n int, err error)
    40  }
    41  
    42  // ReadWriter is the interface that groups the basic Read and Write methods.
    43  type ReadWriter interface {
    44  	Reader
    45  	// contains filtered or unexported methods
    46  }
    47  
    48  // ReadCloser is the interface that groups the basic Read and Close methods.
    49  type ReadCloser interface {
    50  	Reader
    51  	// contains filtered or unexported methods
    52  }
    53  
    54  // ReadWriteCloser is the interface that groups the basic Read, Write and Close methods.
    55  type ReadWriteCloser interface {
    56  	Reader
    57  	// contains filtered or unexported methods
    58  }
    59  
    60  // ReadSeeker is the interface that groups the basic Read and Seek methods.
    61  type ReadSeeker interface {
    62  	Reader
    63  	// contains filtered or unexported methods
    64  }
    65  
    66  // ReadWriteSeeker is the interface that groups the basic Read, Write and Seek methods.
    67  type ReadWriteSeeker interface {
    68  	Reader
    69  	// contains filtered or unexported methods
    70  }
    71  
    72  type Conn interface {
    73  	Read(b []byte) (n int, err error)
    74  	Write(b []byte) (n int, err error)
    75  	Close() error
    76  	// ... some additional methods omitted ...
    77  }
    78  
    79  // Copy copies from src to dst until either EOF is reached
    80  // on src or an error occurs.  It returns the number of bytes
    81  // copied and the first error encountered while copying, if any.
    82  func Copy(dst Writer, src Reader) (written int64, err error)