reopen

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2018 License: Apache-2.0 Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BufferedFileWriter

type BufferedFileWriter struct {
	OrigWriter *FileWriter
	BufWriter  *bufio.Writer
	// contains filtered or unexported fields
}

BufferedFileWriter is buffer writer than can be reopened.

func NewBufferedFileWriter

func NewBufferedFileWriter(w *FileWriter) *BufferedFileWriter

NewBufferedFileWriter opens a buffered file that is periodically flushed.

func NewBufferedFileWriterSize

func NewBufferedFileWriterSize(w *FileWriter, size int, flush time.Duration) *BufferedFileWriter

NewBufferedFileWriterSize opens a buffered file with the given size that is periodically flushed on the given interval.

func (*BufferedFileWriter) Close

func (bw *BufferedFileWriter) Close() error

Close flushes the internal buffer and closes the destination file.

func (*BufferedFileWriter) Flush

func (bw *BufferedFileWriter) Flush() (err error)

Flush flushes the buffer.

func (*BufferedFileWriter) Reopen

func (bw *BufferedFileWriter) Reopen() error

Reopen implement Reopener.

func (*BufferedFileWriter) Write

func (bw *BufferedFileWriter) Write(p []byte) (int, error)

Write implements io.Writer (and reopen.Writer).

type FileWriter

type FileWriter struct {
	// contains filtered or unexported fields
}

FileWriter that can also be reopened.

func NewFileWriter

func NewFileWriter(name string) (*FileWriter, error)

NewFileWriter opens a file for appending and writing and can be reopened. It is a ReopenWriteCloser...

func NewFileWriterMode

func NewFileWriterMode(name string, mode os.FileMode) (*FileWriter, error)

NewFileWriterMode opens a Reopener file with a specific permission.

func (*FileWriter) Close

func (f *FileWriter) Close() error

Close calls the under lying File.Close().

func (*FileWriter) Reopen

func (f *FileWriter) Reopen() error

Reopen the file.

func (*FileWriter) Write

func (f *FileWriter) Write(p []byte) (int, error)

Write implements the stander io.Writer interface.

type Reopener

type Reopener interface {
	Reopen() error
}

Reopener interface defines something that can be reopened.

type WriteCloser

type WriteCloser interface {
	Reopener
	io.WriteCloser
}

WriteCloser is a io.WriteCloser that can also be reopened.

type Writer

type Writer interface {
	Reopener
	io.Writer
}

Writer is a writer that also can be reopened.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL