Documentation
¶
Index ¶
- func Read(r io.Reader) (gpxFiles []gpx.GPX, err error)
- func ReadFile(fileName string) (gpxFile gpx.GPX, err error)
- func ReadFileSystem(fileName string) (gpxFiles []gpx.GPX, err error)
- func ReadFolder(folderName string) (gpxFiles []gpx.GPX, err error)
- func WriteFiles(fileName string, outFiles []gpx.GPX) (err error)
- func WriteStdout(outFiles []gpx.GPX) (err error)
- type DelimReader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Read ¶
Read reads gpx data that is written, e.g., to STDIN. If multiple gpx files are written to the reader, it separates those based on the ending tag "</gpx>"
func ReadFile ¶
ReadFile reads a single file from the file system that is identified with the provided fileName
func ReadFileSystem ¶
ReadFileSystem reads file(s) from the filesystem using the provided path (fileName). If fileName is a folder, it reads all top-level files ending with ".gpx" or ".GPX" in that folder
func ReadFolder ¶
ReadFolder reads the GPX files (ending with ".gpx" or ".GPX") of a folder (without recursion) and returns their contents
func WriteStdout ¶
Types ¶
type DelimReader ¶
type DelimReader struct {
// contains filtered or unexported fields
}
A custom reader that tries to separate, e.g., multiple GPX files from a single stream. This is done by searching for a delimiter.
func NewDelimReader ¶
func NewDelimReader(reader *bufio.Reader, delimiter []byte) DelimReader
NewDelimReader creates a new DelimReader that reads from reader and splits based on the provided delimiter.
The delimiter's last byte must not occur in previous bytes of the delimiter. This works, e.g., if delim is "</gpx>", as ">" only occurs once.
func NewGPXReader ¶
func NewGPXReader(reader *bufio.Reader) DelimReader
NewGPXReader creates a new DelimReader that reads from reader and splits concatenated GPX files.
func (DelimReader) ReadToNextDelim ¶
func (s DelimReader) ReadToNextDelim() (p []byte, err error)
ReadToNextDelim reads to the next full delimiter and returns all bytes that came before (including the delimiter). Reads until EOF and also returns the rest between the last delimiter and EOF. Returns err as io.EOF, if the end of the file is reached.