Package com.azure.storage.blob.nio
Class AzureSeekableByteChannel
- java.lang.Object
-
- com.azure.storage.blob.nio.AzureSeekableByteChannel
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,ByteChannel
,Channel
,ReadableByteChannel
,SeekableByteChannel
,WritableByteChannel
public final class AzureSeekableByteChannel extends Object implements SeekableByteChannel
A byte channel that maintains a current position.A channel may only be opened in read mode OR write mode. It may not be opened in read/write mode. Seeking is supported for reads, but not for writes. Modifications to existing files is not permitted--only creating new files or overwriting existing files.
This type is not threadsafe to prevent having to hold locks across network calls.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
boolean
isOpen()
long
position()
AzureSeekableByteChannel
position(long newPosition)
int
read(ByteBuffer dst)
long
size()
AzureSeekableByteChannel
truncate(long size)
int
write(ByteBuffer src)
-
-
-
Method Detail
-
read
public int read(ByteBuffer dst) throws IOException
- Specified by:
read
in interfaceReadableByteChannel
- Specified by:
read
in interfaceSeekableByteChannel
- Throws:
IOException
-
write
public int write(ByteBuffer src) throws IOException
- Specified by:
write
in interfaceSeekableByteChannel
- Specified by:
write
in interfaceWritableByteChannel
- Throws:
IOException
-
position
public long position() throws IOException
- Specified by:
position
in interfaceSeekableByteChannel
- Throws:
IOException
-
position
public AzureSeekableByteChannel position(long newPosition) throws IOException
- Specified by:
position
in interfaceSeekableByteChannel
- Throws:
IOException
-
size
public long size() throws IOException
- Specified by:
size
in interfaceSeekableByteChannel
- Throws:
IOException
-
truncate
public AzureSeekableByteChannel truncate(long size) throws IOException
- Specified by:
truncate
in interfaceSeekableByteChannel
- Throws:
IOException
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceChannel
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
-