Golang index.suffixarray.Read() function example

package index/suffixarray

Golang index.suffixarray.Read() function usage example

 package main

 import (
 "fmt"
 "index/suffixarray"
 "strings"
 "bytes"
 )

 func main() {

 str := []string{"yum", "tasty", "taste good", "delicious", "sumptuous", "lavish", "palatable", "pleasant"}
 strByte := "\x00" + strings.Join(str, "\x00")

 index := suffixarray.New([]byte(strByte))

 reader := bytes.NewReader([]byte("small"))

 fmt.Println("Length before read : ", reader.Len())

 index.Read(reader)

 fmt.Println("Length after read : ", reader.Len())

 }

Reference :

http://golang.org/pkg/index/suffixarray/#Index.Read

Advertisement