Documentation
¶
Index ¶
Constants ¶
const ( HeaderByteSize = 60 MagicString = "!<arch>\n" )
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Header ¶
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader provides sequential access to the contents of a ar archive.
Reader.Next advances to the next file in the archive (including the first), and then Reader can be treated as an io.Reader to access the file's data.
func NewReader ¶
NewReader creates a new Reader reading from r.
An error is returned when the reader is not an ar file.
func (*Reader) Next ¶
Next advances to the next entry in the ar archive.
The Header.Size determines how many bytes can be read for the next file. Any remaining data in the current file is automatically discarded.
io.EOF is returned at the end of the input.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer provides sequential writing of a ar archive.
Write.WriteMagicBytes begins a new file, then WriteHeader begins a new file with the provided Header, and then Writer can be treated as an io.Writer to supply that file's data.
func (*Writer) Write ¶
Write writes to the current file in the ar archive.
Write returns the error ErrWriteTooLong if more than Header.Size bytes are written after WriteHeader.
func (*Writer) WriteHeader ¶
WriteHeader writes header and prepares to accept the file's contents.
The Header.Size determines how many bytes can be written for the next file. If the current file is not fully written, then this returns an error.