All Downloads are FREE. Search and download functionalities are using the official Maven repository.

java.nio.channels.AsynchronousFileChannel Maven / Gradle / Ivy

Go to download

JVM AOT compiler currently generating JavaScript, C++, Haxe, with initial focus on Kotlin and games.

There is a newer version: 0.6.8
Show newest version
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 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;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy