Imported GNU Classpath 0.92
2006-08-14 Mark Wielaard <mark@klomp.org> Imported GNU Classpath 0.92 * HACKING: Add more importing hints. Update automake version requirement. * configure.ac (gconf-peer): New enable AC argument. Add --disable-gconf-peer and --enable-default-preferences-peer to classpath configure when gconf is disabled. * scripts/makemake.tcl: Set gnu/java/util/prefs/gconf and gnu/java/awt/dnd/peer/gtk to bc. Classify gnu/java/security/Configuration.java as generated source file. * gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java, gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java, gnu/java/lang/management/VMClassLoadingMXBeanImpl.java, gnu/java/lang/management/VMRuntimeMXBeanImpl.java, gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java, gnu/java/lang/management/VMThreadMXBeanImpl.java, gnu/java/lang/management/VMMemoryMXBeanImpl.java, gnu/java/lang/management/VMCompilationMXBeanImpl.java: New VM stub classes. * java/lang/management/VMManagementFactory.java: Likewise. * java/net/VMURLConnection.java: Likewise. * gnu/java/nio/VMChannel.java: Likewise. * java/lang/Thread.java (getState): Add stub implementation. * java/lang/Class.java (isEnum): Likewise. * java/lang/Class.h (isEnum): Likewise. * gnu/awt/xlib/XToolkit.java (getClasspathTextLayoutPeer): Removed. * javax/naming/spi/NamingManager.java: New override for StackWalker functionality. * configure, sources.am, Makefile.in, gcj/Makefile.in, include/Makefile.in, testsuite/Makefile.in: Regenerated. From-SVN: r116139
This commit is contained in:
parent
abab460491
commit
ac1ed908de
1294 changed files with 99479 additions and 35933 deletions
|
@ -40,6 +40,7 @@ package gnu.java.nio.channels;
|
|||
|
||||
import gnu.classpath.Configuration;
|
||||
import gnu.java.nio.FileLockImpl;
|
||||
import gnu.java.nio.VMChannel;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
|
@ -102,6 +103,7 @@ public final class FileChannelImpl extends FileChannel
|
|||
// we want to make sure this has the value -1. This is the most
|
||||
// efficient way to accomplish that.
|
||||
private int fd = -1;
|
||||
private VMChannel ch;
|
||||
|
||||
private int mode;
|
||||
|
||||
|
@ -123,6 +125,7 @@ public final class FileChannelImpl extends FileChannel
|
|||
description = path;
|
||||
fd = open (path, mode);
|
||||
this.mode = mode;
|
||||
this.ch = VMChannel.getVMChannel(this);
|
||||
|
||||
// First open the file and then check if it is a a directory
|
||||
// to avoid race condition.
|
||||
|
@ -155,6 +158,7 @@ public final class FileChannelImpl extends FileChannel
|
|||
this.fd = fd;
|
||||
this.mode = mode;
|
||||
this.description = "descriptor(" + fd + ")";
|
||||
this.ch = VMChannel.getVMChannel(this);
|
||||
}
|
||||
|
||||
private native int open (String path, int mode) throws FileNotFoundException;
|
||||
|
@ -181,6 +185,7 @@ public final class FileChannelImpl extends FileChannel
|
|||
|
||||
public int read (ByteBuffer dst) throws IOException
|
||||
{
|
||||
/*
|
||||
int result;
|
||||
byte[] buffer = new byte [dst.remaining ()];
|
||||
|
||||
|
@ -190,6 +195,8 @@ public final class FileChannelImpl extends FileChannel
|
|||
dst.put (buffer, 0, result);
|
||||
|
||||
return result;
|
||||
*/
|
||||
return ch.read(dst);
|
||||
}
|
||||
|
||||
public int read (ByteBuffer dst, long position)
|
||||
|
@ -214,33 +221,12 @@ public final class FileChannelImpl extends FileChannel
|
|||
public long read (ByteBuffer[] dsts, int offset, int length)
|
||||
throws IOException
|
||||
{
|
||||
long result = 0;
|
||||
|
||||
for (int i = offset; i < offset + length; i++)
|
||||
{
|
||||
result += read (dsts [i]);
|
||||
}
|
||||
|
||||
return result;
|
||||
return ch.readScattering(dsts, offset, length);
|
||||
}
|
||||
|
||||
public int write (ByteBuffer src) throws IOException
|
||||
{
|
||||
int len = src.remaining ();
|
||||
if (src.hasArray())
|
||||
{
|
||||
byte[] buffer = src.array();
|
||||
write(buffer, src.arrayOffset() + src.position(), len);
|
||||
src.position(src.position() + len);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use a more efficient native method! FIXME!
|
||||
byte[] buffer = new byte [len];
|
||||
src.get (buffer, 0, len);
|
||||
write (buffer, 0, len);
|
||||
}
|
||||
return len;
|
||||
return ch.write(src);
|
||||
}
|
||||
|
||||
public int write (ByteBuffer src, long position)
|
||||
|
@ -274,14 +260,7 @@ public final class FileChannelImpl extends FileChannel
|
|||
public long write(ByteBuffer[] srcs, int offset, int length)
|
||||
throws IOException
|
||||
{
|
||||
long result = 0;
|
||||
|
||||
for (int i = offset;i < offset + length;i++)
|
||||
{
|
||||
result += write (srcs[i]);
|
||||
}
|
||||
|
||||
return result;
|
||||
return ch.writeGathering(srcs, offset, length);
|
||||
}
|
||||
|
||||
public native MappedByteBuffer mapImpl (char mode, long position, int size)
|
||||
|
@ -563,4 +542,12 @@ public final class FileChannelImpl extends FileChannel
|
|||
+ ",mode=" + mode + ","
|
||||
+ description + "]");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The native file descriptor.
|
||||
*/
|
||||
public int getNativeFD()
|
||||
{
|
||||
return fd;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue