This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
FYI: Patch: java.nio.Buffer and java.nio.MappedByteBuffer
- From: Michael Koch <konqueror at gmx dot de>
- To: java-patches at gcc dot gnu dot org
- Date: Mon, 13 Oct 2003 06:55:37 +0200
- Subject: FYI: Patch: java.nio.Buffer and java.nio.MappedByteBuffer
hi list,
I commited the attached patch to trunk to do two things:
1) makes Buffer.hasRemaining() more clear.
2) implements MappedByteBuffer as fas as possible for now.
Michael
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.2259
diff -u -b -B -r1.2259 ChangeLog
--- ChangeLog 12 Oct 2003 13:39:06 -0000 1.2259
+++ ChangeLog 13 Oct 2003 04:37:52 -0000
@@ -1,3 +1,13 @@
+2003-10-13 Michael Koch <konqueror@gmx.de>
+
+ * java/nio/Buffer.java
+ (hasRemaining): Made implementation more clear.
+ * java/nio/MappedByteBuffer.java
+ (loaded): New member variable.
+ (force): Added comment.
+ (isLoaded): Return value of loaded.
+ (load): Set loaded to true, added comment.
+
2003-10-12 Michael Koch <konqueror@gmx.de>
* gnu/java/nio/PipeImpl.java
Index: java/nio/Buffer.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/nio/Buffer.java,v
retrieving revision 1.5
diff -u -b -B -r1.5 Buffer.java
--- java/nio/Buffer.java 24 Jun 2003 11:19:05 -0000 1.5
+++ java/nio/Buffer.java 13 Oct 2003 04:37:52 -0000
@@ -1,5 +1,5 @@
/* Buffer.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -102,7 +102,7 @@
*/
public final boolean hasRemaining ()
{
- return limit > pos;
+ return remaining() > 0;
}
/**
Index: java/nio/MappedByteBuffer.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/nio/MappedByteBuffer.java,v
retrieving revision 1.3
diff -u -b -B -r1.3 MappedByteBuffer.java
--- java/nio/MappedByteBuffer.java 11 Jun 2003 10:38:58 -0000 1.3
+++ java/nio/MappedByteBuffer.java 13 Oct 2003 04:37:52 -0000
@@ -44,6 +44,8 @@
*/
public abstract class MappedByteBuffer extends ByteBuffer
{
+ private boolean loaded = false;
+
MappedByteBuffer (int capacity, int limit, int position, int mark)
{
super (capacity, limit, position, mark);
@@ -51,16 +53,19 @@
public final MappedByteBuffer force ()
{
+ // FIXME: Flush to disk here.
return this;
}
public final boolean isLoaded ()
{
- return true;
+ return loaded;
}
public final MappedByteBuffer load ()
{
+ // FIXME: Try to load all pages into memory.
+ loaded = true;
return this;
}
}