Imports #
"fmt"
"internal/coverage/slicereader"
"internal/coverage/uleb128"
"io"
"fmt"
"internal/coverage/slicereader"
"internal/coverage/uleb128"
"io"
Reader is a helper for reading a string table previously serialized by a Writer.Write call.
type Reader struct {
r *slicereader.Reader
strs []string
}
Writer implements a string table writing utility.
type Writer struct {
stab map[string]uint32
strs []string
tmp []byte
frozen bool
}
Entries returns the number of decoded entries in a string table.
func (str *Reader) Entries() int
Freeze sends a signal to the writer that no more additions are allowed, only lookups of existing strings (if a lookup triggers addition, a panic will result). Useful as a mechanism for "finalizing" a string table prior to writing it out.
func (stw *Writer) Freeze()
Get returns string 'idx' within the string table.
func (str *Reader) Get(idx uint32) string
InitWriter initializes a stringtab.Writer.
func (stw *Writer) InitWriter()
Lookup looks up string 's' in the writer's table, adding a new entry if need be, and returning an index into the table.
func (stw *Writer) Lookup(s string) uint32
Nentries returns the number of strings interned so far.
func (stw *Writer) Nentries() uint32
NewReader creates a stringtab.Reader to read the contents of a string table from 'r'.
func NewReader(r *slicereader.Reader) *Reader
Read reads/decodes a string table using the reader provided.
func (str *Reader) Read()
Size computes the memory in bytes needed for the serialized version of a stringtab.Writer.
func (stw *Writer) Size() uint32
Write writes the string table in serialized form to the specified io.Writer.
func (stw *Writer) Write(w io.Writer) error
Generated with Arrow