Add write method for NbtBuffer