java.nio.channels.AsynchronousFileChannel Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jtransc-rt Show documentation
Show all versions of jtransc-rt Show documentation
JVM AOT compiler currently generating JavaScript, C++, Haxe, with initial focus on Kotlin and games.
package java.nio.channels;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.file.OpenOption;
import java.nio.file.Path;
import java.nio.file.attribute.FileAttribute;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
public class AsynchronousFileChannel implements AsynchronousChannel {
protected AsynchronousFileChannel() {
}
native public static AsynchronousFileChannel open(Path file, Set extends OpenOption> options, ExecutorService executor, FileAttribute>... attrs) throws IOException;
@SuppressWarnings({"unchecked", "rawtypes"}) // generic array construction
private static final FileAttribute>[] NO_ATTRIBUTES = new FileAttribute[0];
native public static AsynchronousFileChannel open(Path file, OpenOption... options) throws IOException;
public native long size() throws IOException;
public native AsynchronousFileChannel truncate(long size) throws IOException;
public native void force(boolean metaData) throws IOException;
public native void lock(long position, long size, boolean shared, A attachment, CompletionHandler handler);
public final void lock(A attachment, CompletionHandler handler) {
lock(0L, Long.MAX_VALUE, false, attachment, handler);
}
public native Future lock(long position, long size, boolean shared);
public final Future lock() {
return lock(0L, Long.MAX_VALUE, false);
}
public native FileLock tryLock(long position, long size, boolean shared) throws IOException;
native public final FileLock tryLock() throws IOException;
public native void read(ByteBuffer dst, long position, A attachment, CompletionHandler handler);
public native Future read(ByteBuffer dst, long position);
public native void write(ByteBuffer src, long position, A attachment, CompletionHandler handler);
public native Future write(ByteBuffer src, long position);
native public boolean isOpen();
native public void close() throws IOException;
}