예제 #1
0
// New creates a new Siegfried struct. It initializes the three matchers.
//
// Example:
//  s := New()
//  p, err := pronom.New() // create a new PRONOM identifier
//  if err != nil {
//  	log.Fatal(err)
//  }
//  err = s.Add(p) // add the identifier to the Siegfried
//  if err != nil {
//  	log.Fatal(err)
//  }
//  err = s.Save("pronom.sig") // save the Siegfried
func New() *Siegfried {
	s := &Siegfried{}
	s.C = time.Now()
	s.em = extensionmatcher.New()
	s.cm = containermatcher.New()
	s.bm = bytematcher.New()
	s.tm = textmatcher.New()
	s.buffers = siegreader.New()
	return s
}
예제 #2
0
func (ct *cTest) add(s frames.Signature, t int) {
	if s == nil {
		ct.satisfied = append(ct.satisfied, t)
		return
	}
	// if we haven't created a BM for this node yet, do it now
	if ct.bm == nil {
		ct.bm = bytematcher.New()
		ct.bm.SetLowMem()
	}
	ct.unsatisfied = append(ct.unsatisfied, t)
	ct.buffer = append(ct.buffer, s)
}