public class CountingWritableByteChannel extends Object implements WritableByteChannel
WritableByteChannel that keeps track of the number of written bytes| Constructor and Description |
|---|
CountingWritableByteChannel(WritableByteChannel wrapped) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
long |
count() |
static CountingWritableByteChannel |
from(File file)
Static factory method to create a
CountingWritableByteChannel from an existing File. |
static CountingWritableByteChannel |
from(OutputStream stream)
Static factory method to create a
CountingWritableByteChannel from an existing OutputStream. |
static CountingWritableByteChannel |
from(String file)
Static factory method to create a
CountingWritableByteChannel from an existing file path. |
static CountingWritableByteChannel |
from(WritableByteChannel channel)
Static factory method to create a
CountingWritableByteChannel from an existing WritableByteChannel. |
boolean |
isOpen() |
int |
write(ByteBuffer src) |
public CountingWritableByteChannel(WritableByteChannel wrapped)
public long count()
public int write(ByteBuffer src) throws IOException
write in interface WritableByteChannelIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in interface ChannelIOExceptionpublic static CountingWritableByteChannel from(WritableByteChannel channel)
CountingWritableByteChannel from an existing WritableByteChannel.channel - CountingWritableByteChannelpublic static CountingWritableByteChannel from(OutputStream stream)
CountingWritableByteChannel from an existing OutputStream.stream - CountingWritableByteChannelpublic static CountingWritableByteChannel from(File file) throws IOException
CountingWritableByteChannel from an existing File. If the file already exists its content is purged.file - CountingWritableByteChannelIOExceptionRandomAccessFile.RandomAccessFile(File, String)public static CountingWritableByteChannel from(String file) throws IOException
CountingWritableByteChannel from an existing file path. If the file already exists its content is purged.file - CountingWritableByteChannelIOExceptionRandomAccessFile.RandomAccessFile(String, String)Copyright © 2018 sejda. All rights reserved.