public final class DataHandles extends Object
DataHandle
s.Modifier and Type | Method and Description |
---|---|
static long |
copy(DataHandle<Location> in,
DataHandle<Location> out)
Copies all bytes from the input to the output handle.
|
static long |
copy(DataHandle<Location> in,
DataHandle<Location> out,
int length)
Copies up to
length bytes from the input to the output handle. |
static long |
copy(DataHandle<Location> in,
DataHandle<Location> out,
long length,
Task task)
Copies up to
length bytes from the input to the output handle,
reporting the progress to the provided task. |
static long |
copy(DataHandle<Location> in,
DataHandle<Location> out,
long length,
Task task,
int bufferSize)
Copies up to
length bytes from the input to the output handle,
reporting the progress to the provided task. |
static long |
copy(DataHandle<Location> in,
DataHandle<Location> out,
Task task)
Copies all bytes from the input to the output handle, reporting the
progress to the provided task.
|
protected static IOException |
readOnlyException() |
protected static IOException |
writeOnlyException() |
static int |
writeUTF(String str,
DataOutput out)
Writes a string to the specified DataOutput using modified UTF-8 encoding
in a machine-independent manner.
|
public static int writeUTF(String str, DataOutput out) throws IOException
First, two bytes are written to out as if by the writeShort
method
giving the number of bytes to follow. This value is the number of bytes
actually written out, not the length of the string. Following the length,
each character of the string is output, in sequence, using the modified
UTF-8 encoding for the character. If no exception is thrown, the counter
written
is incremented by the total number of bytes written to the
output stream. This will be at least two plus the length of str
,
and at most two plus thrice the length of str
.
str
- a string to be written.out
- destination to write toIOException
- if an I/O error occurs.protected static IOException readOnlyException()
protected static IOException writeOnlyException()
public static long copy(DataHandle<Location> in, DataHandle<Location> out) throws IOException
in
- the input handleout
- the output handleIOException
- if an I/O error occurs.public static long copy(DataHandle<Location> in, DataHandle<Location> out, Task task) throws IOException
in
- the input handleout
- the output handletask
- task to report progress toIOException
- if an I/O error occurs.public static long copy(DataHandle<Location> in, DataHandle<Location> out, int length) throws IOException
length
bytes from the input to the output handle.
Reading and writing start at the current positions of the handles. Stops
early if there are no more bytes available from the input handle.in
- the input handleout
- the output handlelength
- maximum number of bytes to copy; will copy all bytes if set
to 0
IOException
- if an I/O error occurs.public static long copy(DataHandle<Location> in, DataHandle<Location> out, long length, Task task) throws IOException
length
bytes from the input to the output handle,
reporting the progress to the provided task. Reading and writing start at
the current positions of the handles. Stops early if there are no more
bytes available from the input handle.in
- input handleout
- the output handlelength
- maximum number of bytes to copy; will copy all bytes if set
to 0
task
- a task object to use for reporting the status of the copy
operation. Can be null
if no reporting is needed.IOException
- if an I/O error occurs.public static long copy(DataHandle<Location> in, DataHandle<Location> out, long length, Task task, int bufferSize) throws IOException
length
bytes from the input to the output handle,
reporting the progress to the provided task. Reading and writing start at
the current positions of the handles. Stops early if there are no more
bytes available from the input handle. Uses a buffer of the provided size,
instead of using the default size.in
- input handleout
- the output handlelength
- maximum number of bytes to copy, will copy all bytes if set
to 0
task
- a task object to use for reporting the status of the copy
operation. Can be null
if no reporting is needed.IOException
- if an I/O error occurs.Copyright © 2015–2022 SciJava. All rights reserved.