Documentation
¶
Index ¶
- type SplitFileWriter
- func Create(namePrefix, nameSuffix string, maxWrites int) (*SplitFileWriter, error)
- func New(namePrefix, nameSuffix string, currentInc, maxWrites, fileFlag int, ...) (*SplitFileWriter, error)
- func Open(namePrefix, nameSuffix string, maxWrites, fileFlag int, filePerm os.FileMode) (*SplitFileWriter, error)
- func (s *SplitFileWriter) Buffered() int
- func (s *SplitFileWriter) CurrentFileName() string
- func (s *SplitFileWriter) Flush() error
- func (s *SplitFileWriter) NextFileName() string
- func (s *SplitFileWriter) PrevFileName() string
- func (s *SplitFileWriter) ReadFrom(r io.Reader) (int64, error)
- func (s *SplitFileWriter) Write(p []byte) (int, error)
- func (s *SplitFileWriter) WriteByte(c byte) error
- func (s *SplitFileWriter) WriteRune(r rune) (int, error)
- func (s *SplitFileWriter) WriteString(st string) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SplitFileWriter ¶
type SplitFileWriter struct {
NamePrefix string
NameSuffix string
MaxWrites int
FileFlag int
FilePerm os.FileMode
CurrentFile *os.File
CurrentBuf *bufio.Writer
WriteCount int
CurrentInc int
FullFileCallback func(*SplitFileWriter) error
}
SplitFileWriter is a bufio writer which writes to a different file every `n` writes
func Create ¶
func Create(namePrefix, nameSuffix string, maxWrites int) (*SplitFileWriter, error)
Create calls os.Create and then creates a new SplitFileWriter from it
func New ¶
func New(namePrefix, nameSuffix string, currentInc, maxWrites, fileFlag int, filePerm os.FileMode, bufSize int, newFileCallback func(*SplitFileWriter) error) (*SplitFileWriter, error)
New calls os.OpenFile and then creates a new SplitFileWriter from it, setting all struct members
func Open ¶
func Open(namePrefix, nameSuffix string, maxWrites, fileFlag int, filePerm os.FileMode) (*SplitFileWriter, error)
Open calls os.OpenFile and then creates a new SplitFileWriter from it
func (*SplitFileWriter) Buffered ¶
func (s *SplitFileWriter) Buffered() int
Buffered returns the number of bytes that have been written into the current buffer.
func (*SplitFileWriter) CurrentFileName ¶
func (s *SplitFileWriter) CurrentFileName() string
CurrentFileName returns the path of the current file open for writing.
func (*SplitFileWriter) Flush ¶
func (s *SplitFileWriter) Flush() error
Flush writes any buffered data to the underlying io.Writer.
func (*SplitFileWriter) NextFileName ¶
func (s *SplitFileWriter) NextFileName() string
NextFileName returns the path of the next file that will be opened for writing.
func (*SplitFileWriter) PrevFileName ¶
func (s *SplitFileWriter) PrevFileName() string
PrevFileName returns the path of the last file that was opened for writing.
func (*SplitFileWriter) ReadFrom ¶
func (s *SplitFileWriter) ReadFrom(r io.Reader) (int64, error)
ReadFrom implements io.ReaderFrom.
func (*SplitFileWriter) Write ¶
func (s *SplitFileWriter) Write(p []byte) (int, error)
Write writes the contents of p into the buffer.
func (*SplitFileWriter) WriteByte ¶
func (s *SplitFileWriter) WriteByte(c byte) error
WriteByte writes a single byte.
func (*SplitFileWriter) WriteRune ¶
func (s *SplitFileWriter) WriteRune(r rune) (int, error)
WriteRune writes a single Unicode code point, returning the number of bytes written and any error.
func (*SplitFileWriter) WriteString ¶
func (s *SplitFileWriter) WriteString(st string) (int, error)
WriteString writes a string. It returns the number of bytes written.