Skip to content

Commit

Permalink
Added Station URL methods to StreamIn
Browse files Browse the repository at this point in the history
  • Loading branch information
jonbarrow committed Apr 7, 2023
1 parent ebc095e commit d65b2f2
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions stream_in.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,17 @@ func (stream *StreamIn) ReadDataHolder() *DataHolder {
return dataHolder
}

// ReadStationURL reads a StationURL type
func (stream *StreamIn) ReadStationURL() *StationURL {
stationString, err := stream.ReadString()
if err != nil {
// TODO - Make this maybe return an error?
logger.Error(err.Error())
}

return NewStationURL(stationString)
}

// ReadListUInt8 reads a list of uint8 types
func (stream *StreamIn) ReadListUInt8() []uint8 {
length := stream.ReadUInt32LE()
Expand Down Expand Up @@ -292,6 +303,19 @@ func (stream *StreamIn) ReadListQBuffer() [][]byte {
return list
}

// ReadListStationURL reads a list of NEX Station URL types
func (stream *StreamIn) ReadListStationURL() []*StationURL {
length := stream.ReadUInt32LE()
list := make([]*StationURL, 0, length)

for i := 0; i < int(length); i++ {
value := stream.ReadStationURL()
list = append(list, value)
}

return list
}

// ReadListStructure reads and returns a list structure types
func (stream *StreamIn) ReadListStructure(structure StructureInterface) (interface{}, error) {
length := stream.ReadUInt32LE()
Expand Down

0 comments on commit d65b2f2

Please sign in to comment.