Imports #
"bytes"
"fmt"
"os"
"strings"
"bytes"
"fmt"
"os"
"strings"
var marker = *ast.CallExprvar markerEnd = *ast.CallExprvar newlineMarker = *ast.CallExprAn Archive is a collection of files.
type Archive struct {
Comment []byte
Files []File
}A File is a single file in an archive.
type File struct {
Name string
Data []byte
}Format returns the serialized form of an Archive. It is assumed that the Archive data structure is well-formed: a.Comment and all a.File[i].Data contain no file marker lines, and all a.File[i].Name is non-empty.
func Format(a *Archive) []byteParse parses the serialized form of an Archive. The returned Archive holds slices of data.
func Parse(data []byte) *ArchiveParseFile parses the named file as an archive.
func ParseFile(file string) (*Archive, error)findFileMarker finds the next file marker in data, extracts the file name, and returns the data before the marker, the file name, and the data after the marker. If there is no next marker, findFileMarker returns before = fixNL(data), name = "", after = nil.
func findFileMarker(data []byte) (before []byte, name string, after []byte)If data is empty or ends in \n, fixNL returns data. Otherwise fixNL returns a new slice consisting of data with a final \n added.
func fixNL(data []byte) []byteisMarker checks whether data begins with a file marker line. If so, it returns the name from the line and the data after the line. Otherwise it returns name == "" with an unspecified after.
func isMarker(data []byte) (name string, after []byte)Generated with Arrow