Skip to content

Pincheng0101/goth-bytebuf

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoTH-bytebuf

make byte stream operation more easily

HOWTO

create empty byte buffer

    buf := EmptyByteBuf()

write string to byte buffer

    buf.WriteString("abcdef")

write int64 value to byte buffer

    buf.WriteInt64(int64(12345))

make a clone of current readable bytes

    clone := buf.Clone()

read 8 bytes array as int64 value from byte buffer

    buf := EmptyByteBuf()
    buf.WriteInt64(int64(12345)) // readable bytes len = 8
    v := buf.ReadInt64() // v = int64(12345)

skip 2 bytes and read 3 bytes of byte buffer

    bs := buf.Skip(2).ReadBytes(3)

reset byte buffer

    buf.Reset()

About

byte array operation tool

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Go 100.0%