stringtab

Imports

Imports #

"fmt"
"internal/coverage/slicereader"
"internal/coverage/uleb128"
"io"

Structs

Reader struct #

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 struct #

Writer implements a string table writing utility.

type Writer struct {
stab map[string]uint32
strs []string
tmp []byte
frozen bool
}

Functions

Entries method #

Entries returns the number of decoded entries in a string table.

func (str *Reader) Entries() int

Freeze method #

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 method #

Get returns string 'idx' within the string table.

func (str *Reader) Get(idx uint32) string

InitWriter method #

InitWriter initializes a stringtab.Writer.

func (stw *Writer) InitWriter()

Lookup method #

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 method #

Nentries returns the number of strings interned so far.

func (stw *Writer) Nentries() uint32

NewReader function #

NewReader creates a stringtab.Reader to read the contents of a string table from 'r'.

func NewReader(r *slicereader.Reader) *Reader

Read method #

Read reads/decodes a string table using the reader provided.

func (str *Reader) Read()

Size method #

Size computes the memory in bytes needed for the serialized version of a stringtab.Writer.

func (stw *Writer) Size() uint32

Write method #

Write writes the string table in serialized form to the specified io.Writer.

func (stw *Writer) Write(w io.Writer) error

Generated with Arrow