MappedByteBuffer.java: (forceImpl...

* java/nio/MappedByteBuffer.java: (forceImpl, isLoadedImpl, loadImpl,
	unmapImpl):  New dummy methods, to be overridden by subclass.
	(finalize, isLoaded, load, force):  New methods.
	* java/nio/MappedByteBufferImpl.java:  More-or-less rewrite.
	Now works, at least for read mapping.

From-SVN: r78662
This commit is contained in:
Per Bothner 2004-02-29 11:12:45 -08:00
parent ef3916ef8e
commit d199feb748
2 changed files with 103 additions and 47 deletions

View file

@ -44,28 +44,46 @@ package java.nio;
*/
public abstract class MappedByteBuffer extends ByteBuffer
{
private boolean loaded = false;
MappedByteBuffer (int capacity, int limit, int position, int mark)
{
super (capacity, limit, position, mark);
}
void forceImpl()
{
}
public final MappedByteBuffer force ()
{
// FIXME: Flush to disk here.
forceImpl();
return this;
}
boolean isLoadedImpl()
{
load();
return true;
}
public final boolean isLoaded ()
{
return loaded;
return isLoadedImpl();
}
void loadImpl()
{
}
public final MappedByteBuffer load ()
{
// FIXME: Try to load all pages into memory.
loaded = true;
loadImpl();
return this;
}
void unmapImpl ()
{
forceImpl();
}
public void finalize () { unmapImpl(); }
}