// NewDataReader returns a new callback based data buffer func NewDataReader(r io.Reader) (*Data, error) { d := newData() d.r = r d.cbs.read = C.gpgme_data_read_cb_t(C.gogpgme_readfunc) cbc := callbackAdd(d) d.cbc = cbc return d, handleError(C.gogpgme_data_new_from_cbs(&d.dh, &d.cbs, C.uintptr_t(cbc))) }
// NewDataReadWriteSeeker returns a new callback based data buffer func NewDataReadWriteSeeker(rw io.ReadWriteSeeker) (*Data, error) { d := newData() d.r = rw d.w = rw d.s = rw d.cbs.read = C.gpgme_data_read_cb_t(C.gogpgme_readfunc) d.cbs.write = C.gpgme_data_write_cb_t(C.gogpgme_writefunc) d.cbs.seek = C.gpgme_data_seek_cb_t(C.gogpgme_seekfunc) cbc := callbackAdd(d) d.cbc = cbc return d, handleError(C.gogpgme_data_new_from_cbs(&d.dh, &d.cbs, C.uintptr_t(cbc))) }