bufiter.go raw

   1  package transport
   2  
   3  //
   4  // type (
   5  // 	Buf     [][]byte
   6  // 	BufIter struct {
   7  // 		Buf
   8  // 		cursor int
   9  // 	}
  10  // )
  11  //
  12  // // NewBufIter returns a new BufIter loaded with a given slice of Buf
  13  // func NewBufIter(buf Buf) *BufIter {
  14  // 	return &BufIter{Buf: buf}
  15  // }
  16  //
  17  // // Len returns the length of the buffer
  18  // func (b *BufIter) Len() int {
  19  // 	return len(b.Buf)
  20  // }
  21  //
  22  // // Get returns the currently selected Buf
  23  // func (b *BufIter) Get() []byte {
  24  // 	return b.Buf[b.cursor]
  25  // }
  26  //
  27  // // More returns true if the cursor is not at the end
  28  // func (b *BufIter) More() bool {
  29  // 	return b.cursor < len(b.Buf)
  30  // }
  31  //
  32  // // Reset sets a buf iter to zero, not necessary to use first time iterating
  33  // func (b *BufIter) Reset() {
  34  // 	b.cursor = 0
  35  // }
  36  //
  37  // // Next returns the next item in a buffer
  38  // func (b *BufIter) Next() (buf []byte) {
  39  // 	if b.cursor > len(b.Buf) {
  40  // 	} else {
  41  // 		buf = b.Buf[b.cursor]
  42  // 		b.cursor++
  43  // 	}
  44  // 	return
  45  // }
  46