Blame vendor/github.com/Azure/azure-storage-blob-go/azblob/bytes_writer.go

Packit Service 3a6627
package azblob
Packit Service 3a6627
Packit Service 3a6627
import (
Packit Service 3a6627
	"errors"
Packit Service 3a6627
)
Packit Service 3a6627
Packit Service 3a6627
type bytesWriter []byte
Packit Service 3a6627
Packit Service 3a6627
func newBytesWriter(b []byte) bytesWriter {
Packit Service 3a6627
	return b
Packit Service 3a6627
}
Packit Service 3a6627
Packit Service 3a6627
func (c bytesWriter) WriteAt(b []byte, off int64) (int, error) {
Packit Service 3a6627
	if off >= int64(len(c)) || off < 0 {
Packit Service 3a6627
		return 0, errors.New("Offset value is out of range")
Packit Service 3a6627
	}
Packit Service 3a6627
Packit Service 3a6627
	n := copy(c[int(off):], b)
Packit Service 3a6627
	if n < len(b) {
Packit Service 3a6627
		return n, errors.New("Not enough space for all bytes")
Packit Service 3a6627
	}
Packit Service 3a6627
Packit Service 3a6627
	return n, nil
Packit Service 3a6627
}