public abstract class DataSource extends Object implements AutoCloseable
Constructor and Description |
---|
DataSource() |
Modifier and Type | Method and Description |
---|---|
void |
close() |
long |
deviceRead(long offset,
DeviceMemoryBuffer dest,
Cuda.Stream stream)
Read data from the source at the given offset into dest.
|
long |
getDeviceReadCutoff()
Get the size cutoff between device reads and host reads when device reads are supported.
|
abstract long |
hostRead(long offset,
HostMemoryBuffer dest)
Read data from the source at the given offset into dest.
|
abstract HostMemoryBuffer |
hostRead(long offset,
long amount)
Read data from the source at the given offset.
|
protected void |
onHostBufferDone(HostMemoryBuffer buffer)
Called when the buffer returned from hostRead is done.
|
abstract long |
size()
Get the size of the source in bytes.
|
boolean |
supportsDeviceRead()
Return true if this supports reading directly to the device else false.
|
public void close()
close
in interface AutoCloseable
public abstract long size()
public abstract HostMemoryBuffer hostRead(long offset, long amount) throws IOException
offset
- where to start reading from.amount
- the maximum number of bytes to read.IOException
- on any error.protected void onHostBufferDone(HostMemoryBuffer buffer)
public abstract long hostRead(long offset, HostMemoryBuffer dest) throws IOException
offset
- the offset to start reading from in the source.dest
- where to write the data.IOException
public boolean supportsDeviceRead()
public long getDeviceReadCutoff()
public long deviceRead(long offset, DeviceMemoryBuffer dest, Cuda.Stream stream) throws IOException
offset
- the offset to start reading fromdest
- where to write the data.stream
- the stream to do the copy on.IOException
Copyright © 2024. All rights reserved.