io

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2018 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package io provides types that enable easy and more consistent input/output by wrapping the standard types

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PanicWriter

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

PanicWriter is a writer that panics if a write operation causes an error.

func NewPanicWriter

func NewPanicWriter(writer io.Writer) *PanicWriter

NewPanicWriter returns a new PanicWriter based on a wrapped io.Writer.

func (*PanicWriter) FWrite

func (w *PanicWriter) FWrite(p ...interface{}) int

FWrite writes the given args to the writer like fmt.Sprint(), and returns the number of bytes that were written. It'll panic if any error occurs during writing.

func (*PanicWriter) FWritef

func (w *PanicWriter) FWritef(format string, p ...interface{}) int

FWritef writes the given args to the writer like fmt.Sprintf(), and returns the number of bytes that were written. It'll panic if any error occurs during writing.

func (*PanicWriter) FWriteln

func (w *PanicWriter) FWriteln(p ...interface{}) int

FWriteln writes the given args to the writer like fmt.Sprintln(), and returns the number of bytes that were written. It'll panic if any error occurs during writing.

func (*PanicWriter) IndentWrites

func (w *PanicWriter) IndentWrites(spaces uint, writesFunc func(*PanicWriter))

IndentWrites takes a number of spaces and a callback where all writes made in the callback are indented by the given space number. If the current writer is already indented, the number of spaces will be additive to the current number of contextual spaces.

func (*PanicWriter) IndentedWriter

func (w *PanicWriter) IndentedWriter(spaces uint) io.Writer

IndentedWriter returns an io.Writer compatible version of the PanicWriter, with a number of spaces to indent all writes. If the current writer is already indented, the number of spaces will be additive to the current number of contextual spaces.

func (*PanicWriter) Write

func (w *PanicWriter) Write(p []byte) int

Write writes a given string to the writer, and returns the number of bytes that were written. It'll panic if any error occurs during writing.

func (*PanicWriter) WriteNewLine

func (w *PanicWriter) WriteNewLine() int

WriteNewLine writes a new-line character to the writer, and returns the number of bytes that were written. It'll panic if any error occurs during writing.

func (*PanicWriter) WriteString

func (w *PanicWriter) WriteString(p string) int

WriteString writes a given string to the writer, and returns the number of bytes that were written. It'll panic if any error occurs during writing.

func (*PanicWriter) WriteStringLine

func (w *PanicWriter) WriteStringLine(p string) int

WriteStringLine writes a given string to the writer with a new-line character after the given string, and returns the number of bytes that were written. It'll panic if any error occurs during writing.

func (*PanicWriter) Writer

func (w *PanicWriter) Writer() io.Writer

Writer returns an io.Writer compatible version of the PanicWriter

type PanicWriterWriter

type PanicWriterWriter PanicWriter

PanicWriterWriter is a writer that wraps the PanicWriter to provide an io.Writer compatible interface for callers

func (*PanicWriterWriter) Write

func (w *PanicWriterWriter) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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