mirror of
https://github.com/corda/corda.git
synced 2025-01-08 14:03:06 +00:00
Merge branch 'master' of oss.readytalk.com:/var/local/git/avian
This commit is contained in:
commit
3ecb950d4c
@ -355,6 +355,27 @@ Java_java_io_File_delete(JNIEnv* e, jclass, jstring path)
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT jboolean JNICALL
|
||||
Java_java_io_File_rename(JNIEnv* e, jclass, jstring old, jstring new_)
|
||||
{
|
||||
const char* oldChars = e->GetStringUTFChars(old, 0);
|
||||
const char* newChars = e->GetStringUTFChars(new_, 0);
|
||||
if (oldChars) {
|
||||
bool v;
|
||||
if (newChars) {
|
||||
v = rename(oldChars, newChars) == 0;
|
||||
|
||||
e->ReleaseStringUTFChars(new_, newChars);
|
||||
} else {
|
||||
v = false;
|
||||
}
|
||||
e->ReleaseStringUTFChars(old, oldChars);
|
||||
return v;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT jboolean JNICALL
|
||||
Java_java_io_File_isDirectory(JNIEnv* e, jclass, jstring path)
|
||||
{
|
||||
|
@ -521,15 +521,18 @@ class Pipe {
|
||||
if (setBlocking(e, pipe[0], false)) {
|
||||
setBlocking(e, pipe[1], false);
|
||||
}
|
||||
|
||||
open_ = true;
|
||||
}
|
||||
|
||||
void dispose() {
|
||||
::close(pipe[0]);
|
||||
::close(pipe[1]);
|
||||
open_ = false;
|
||||
}
|
||||
|
||||
bool connected() {
|
||||
return true;
|
||||
return open_;
|
||||
}
|
||||
|
||||
int reader() {
|
||||
@ -542,6 +545,7 @@ class Pipe {
|
||||
|
||||
private:
|
||||
int pipe[2];
|
||||
bool open_;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -35,6 +35,12 @@ public class File {
|
||||
this(parent.getPath() + FileSeparator + child);
|
||||
}
|
||||
|
||||
public static native boolean rename(String old, String new_);
|
||||
|
||||
public boolean renameTo(File newName) {
|
||||
return rename(path, newName.path);
|
||||
}
|
||||
|
||||
private static native boolean isDirectory(String path);
|
||||
|
||||
public boolean isDirectory() {
|
||||
|
@ -16,6 +16,8 @@ import java.nio.ByteBuffer;
|
||||
public abstract class SelectableChannel implements Channel {
|
||||
private SelectionKey key;
|
||||
|
||||
abstract int socketFD();
|
||||
|
||||
public abstract SelectableChannel configureBlocking(boolean v)
|
||||
throws IOException;
|
||||
|
||||
|
@ -23,6 +23,10 @@ public class ServerSocketChannel extends SelectableChannel {
|
||||
return new ServerSocketChannel();
|
||||
}
|
||||
|
||||
public int socketFD() {
|
||||
return channel.socketFD();
|
||||
}
|
||||
|
||||
public SelectableChannel configureBlocking(boolean v) throws IOException {
|
||||
return channel.configureBlocking(v);
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ class SocketSelector extends Selector {
|
||||
it.hasNext();)
|
||||
{
|
||||
SelectionKey key = it.next();
|
||||
SocketChannel c = (SocketChannel)key.channel();
|
||||
SelectableChannel c = key.channel();
|
||||
int socket = c.socketFD();
|
||||
if (c.isOpen()) {
|
||||
key.readyOps(0);
|
||||
@ -88,7 +88,7 @@ class SocketSelector extends Selector {
|
||||
|
||||
if (r > 0) {
|
||||
for (SelectionKey key : keys) {
|
||||
SocketChannel c = (SocketChannel)key.channel();
|
||||
SelectableChannel c = key.channel();
|
||||
int socket = c.socketFD();
|
||||
int ready = natUpdateReadySet(socket, key.interestOps(), state);
|
||||
key.readyOps(ready);
|
||||
|
Loading…
Reference in New Issue
Block a user