From: Michael Koch Date: Fri, 20 Jun 2003 12:01:54 +0000 (+0000) Subject: MappedByteFileBuffer.java, [...]: Removed X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c52c9fec50c450ea3c495fcfa1267d89be6329de;p=gcc.git MappedByteFileBuffer.java, [...]: Removed 2003-06-20 Michael Koch * gnu/java/nio/MappedByteFileBuffer.java, gnu/java/nio/natMappedByteFileBuffer.cc: Removed * java/nio/MappedByteBufferImpl.java: New file. * gnu/java/nio/FileChannelImpl.java: Use MappedByteBufferImpl instead of MappedByteFileBuffer. * Makefile.am (ordinary_java_source_files): Removed gnu/java/nio/MappedByteFileBuffer.java and added java/nio/MappedByteBufferImpl.java. (nat_source_files): Removed gnu/java/nio/natMappedByteFileBuffer.cc * Makefile.in: Regenerated. From-SVN: r68259 --- diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 1705d758b5a..2d2ffb7a24d 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,19 @@ +2003-06-20 Michael Koch + + * gnu/java/nio/MappedByteFileBuffer.java, + gnu/java/nio/natMappedByteFileBuffer.cc: + Removed + * java/nio/MappedByteBufferImpl.java: + New file. + * gnu/java/nio/FileChannelImpl.java: + Use MappedByteBufferImpl instead of MappedByteFileBuffer. + * Makefile.am + (ordinary_java_source_files): Removed + gnu/java/nio/MappedByteFileBuffer.java and added + java/nio/MappedByteBufferImpl.java. + (nat_source_files): Removed gnu/java/nio/natMappedByteFileBuffer.cc + * Makefile.in: Regenerated. + 2003-06-19 Michael Koch * gnu/java/nio/DatagramChannelImpl.java diff --git a/libjava/Makefile.am b/libjava/Makefile.am index b50f19cba77..0b636e7eb65 100644 --- a/libjava/Makefile.am +++ b/libjava/Makefile.am @@ -2101,7 +2101,6 @@ gnu/java/math/MPN.java \ gnu/java/nio/DatagramChannelImpl.java \ gnu/java/nio/FileChannelImpl.java \ gnu/java/nio/FileLockImpl.java \ -gnu/java/nio/MappedByteFileBuffer.java \ gnu/java/nio/PipeImpl.java \ gnu/java/nio/SelectionKeyImpl.java \ gnu/java/nio/SelectorImpl.java \ @@ -2244,6 +2243,7 @@ java/nio/LongBuffer.java \ java/nio/LongBufferImpl.java \ java/nio/LongViewBufferImpl.java \ java/nio/MappedByteBuffer.java \ +java/nio/MappedByteBufferImpl.java \ java/nio/ReadOnlyBufferException.java \ java/nio/ShortBuffer.java \ java/nio/ShortBufferImpl.java \ @@ -2567,7 +2567,6 @@ gnu/gcj/runtime/natStringBuffer.cc \ gnu/gcj/runtime/natVMClassLoader.cc \ gnu/java/nio/natFileChannelImpl.cc \ gnu/java/nio/natFileLockImpl.cc \ -gnu/java/nio/natMappedByteFileBuffer.cc \ gnu/java/nio/natSelectorImpl.cc \ java/io/natFile.cc \ java/io/natFileDescriptor.cc \ diff --git a/libjava/Makefile.in b/libjava/Makefile.in index b456bb4588f..5580b886479 100644 --- a/libjava/Makefile.in +++ b/libjava/Makefile.in @@ -1863,7 +1863,6 @@ gnu/java/math/MPN.java \ gnu/java/nio/DatagramChannelImpl.java \ gnu/java/nio/FileChannelImpl.java \ gnu/java/nio/FileLockImpl.java \ -gnu/java/nio/MappedByteFileBuffer.java \ gnu/java/nio/PipeImpl.java \ gnu/java/nio/SelectionKeyImpl.java \ gnu/java/nio/SelectorImpl.java \ @@ -2006,6 +2005,7 @@ java/nio/LongBuffer.java \ java/nio/LongBufferImpl.java \ java/nio/LongViewBufferImpl.java \ java/nio/MappedByteBuffer.java \ +java/nio/MappedByteBufferImpl.java \ java/nio/ReadOnlyBufferException.java \ java/nio/ShortBuffer.java \ java/nio/ShortBufferImpl.java \ @@ -2328,7 +2328,6 @@ gnu/gcj/runtime/natStringBuffer.cc \ gnu/gcj/runtime/natVMClassLoader.cc \ gnu/java/nio/natFileChannelImpl.cc \ gnu/java/nio/natFileLockImpl.cc \ -gnu/java/nio/natMappedByteFileBuffer.cc \ gnu/java/nio/natSelectorImpl.cc \ java/io/natFile.cc \ java/io/natFileDescriptor.cc \ @@ -2502,14 +2501,13 @@ gnu/gcj/runtime/natFinalizerThread.lo gnu/gcj/runtime/natFirstThread.lo \ gnu/gcj/runtime/natNameFinder.lo gnu/gcj/runtime/natSharedLibLoader.lo \ gnu/gcj/runtime/natStackTrace.lo gnu/gcj/runtime/natStringBuffer.lo \ gnu/gcj/runtime/natVMClassLoader.lo gnu/java/nio/natFileChannelImpl.lo \ -gnu/java/nio/natFileLockImpl.lo gnu/java/nio/natMappedByteFileBuffer.lo \ -gnu/java/nio/natSelectorImpl.lo java/io/natFile.lo \ -java/io/natFileDescriptor.lo java/io/natObjectInputStream.lo \ -java/io/natVMObjectStreamClass.lo java/lang/natCharacter.lo \ -java/lang/natClass.lo java/lang/natClassLoader.lo \ -java/lang/natConcreteProcess.lo java/lang/natDouble.lo \ -java/lang/natFloat.lo java/lang/natMath.lo java/lang/natObject.lo \ -java/lang/natRuntime.lo java/lang/natString.lo \ +gnu/java/nio/natFileLockImpl.lo gnu/java/nio/natSelectorImpl.lo \ +java/io/natFile.lo java/io/natFileDescriptor.lo \ +java/io/natObjectInputStream.lo java/io/natVMObjectStreamClass.lo \ +java/lang/natCharacter.lo java/lang/natClass.lo \ +java/lang/natClassLoader.lo java/lang/natConcreteProcess.lo \ +java/lang/natDouble.lo java/lang/natFloat.lo java/lang/natMath.lo \ +java/lang/natObject.lo java/lang/natRuntime.lo java/lang/natString.lo \ java/lang/natStringBuffer.lo java/lang/natSystem.lo \ java/lang/natThread.lo java/lang/natVMSecurityManager.lo \ java/lang/ref/natReference.lo java/lang/reflect/natArray.lo \ @@ -2966,8 +2964,8 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \ .deps/gnu/java/locale/LocaleInformation_zh_TW.P \ .deps/gnu/java/math/MPN.P .deps/gnu/java/nio/DatagramChannelImpl.P \ .deps/gnu/java/nio/FileChannelImpl.P .deps/gnu/java/nio/FileLockImpl.P \ -.deps/gnu/java/nio/MappedByteFileBuffer.P .deps/gnu/java/nio/PipeImpl.P \ -.deps/gnu/java/nio/SelectionKeyImpl.P .deps/gnu/java/nio/SelectorImpl.P \ +.deps/gnu/java/nio/PipeImpl.P .deps/gnu/java/nio/SelectionKeyImpl.P \ +.deps/gnu/java/nio/SelectorImpl.P \ .deps/gnu/java/nio/SelectorProviderImpl.P \ .deps/gnu/java/nio/ServerSocketChannelImpl.P \ .deps/gnu/java/nio/SocketChannelImpl.P \ @@ -2982,7 +2980,6 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \ .deps/gnu/java/nio/charset/UTF_8.P \ .deps/gnu/java/nio/natFileChannelImpl.P \ .deps/gnu/java/nio/natFileLockImpl.P \ -.deps/gnu/java/nio/natMappedByteFileBuffer.P \ .deps/gnu/java/nio/natSelectorImpl.P \ .deps/gnu/java/rmi/RMIMarshalledObjectInputStream.P \ .deps/gnu/java/rmi/RMIMarshalledObjectOutputStream.P \ @@ -3498,7 +3495,7 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \ .deps/java/nio/IntBufferImpl.P .deps/java/nio/IntViewBufferImpl.P \ .deps/java/nio/InvalidMarkException.P .deps/java/nio/LongBuffer.P \ .deps/java/nio/LongBufferImpl.P .deps/java/nio/LongViewBufferImpl.P \ -.deps/java/nio/MappedByteBuffer.P \ +.deps/java/nio/MappedByteBuffer.P .deps/java/nio/MappedByteBufferImpl.P \ .deps/java/nio/ReadOnlyBufferException.P .deps/java/nio/ShortBuffer.P \ .deps/java/nio/ShortBufferImpl.P .deps/java/nio/ShortViewBufferImpl.P \ .deps/java/nio/channels/AlreadyConnectedException.P \ diff --git a/libjava/gnu/java/nio/FileChannelImpl.java b/libjava/gnu/java/nio/FileChannelImpl.java index 392f479172c..97929ca786a 100644 --- a/libjava/gnu/java/nio/FileChannelImpl.java +++ b/libjava/gnu/java/nio/FileChannelImpl.java @@ -46,6 +46,7 @@ import java.io.IOException; import java.io.RandomAccessFile; import java.nio.ByteBuffer; import java.nio.MappedByteBuffer; +import java.nio.MappedByteBufferImpl; import java.nio.channels.ClosedChannelException; import java.nio.channels.FileChannel; import java.nio.channels.FileLock; @@ -260,7 +261,7 @@ public class FileChannelImpl extends FileChannel int cmode = mode.m; map_address = nio_mmap_file (position, size, cmode); length = (int) size; - buf = new MappedByteFileBuffer (this); + buf = new MappedByteBufferImpl (this); return buf; } @@ -271,7 +272,7 @@ public class FileChannelImpl extends FileChannel FileChannelImpl ch = new FileChannelImpl (); ch.map_address = map_address; ch.length = (int) length; - ch.buf = new MappedByteFileBuffer (ch); + ch.buf = new MappedByteBufferImpl (ch); return ch.buf; } diff --git a/libjava/gnu/java/nio/MappedByteFileBuffer.java b/libjava/gnu/java/nio/MappedByteFileBuffer.java deleted file mode 100644 index ec6c83c5d70..00000000000 --- a/libjava/gnu/java/nio/MappedByteFileBuffer.java +++ /dev/null @@ -1,449 +0,0 @@ -/* MappedByteFileBuffer.java -- - Copyright (C) 2002 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -package gnu.java.nio; - -import java.nio.ByteBuffer; -import java.nio.CharBuffer; -import java.nio.DoubleBuffer; -import java.nio.FloatBuffer; -import java.nio.IntBuffer; -import java.nio.LongBuffer; -import java.nio.ShortBuffer; -import java.nio.MappedByteBuffer; -import java.io.IOException; -import gnu.gcj.RawData; - -final public class MappedByteFileBuffer - extends MappedByteBuffer -{ - RawData map_address; - boolean readOnly; - boolean direct; - public FileChannelImpl ch; - - public MappedByteFileBuffer (FileChannelImpl ch) throws IOException - { - super ((int) ch.size (), (int) ch.size (), 0, -1); - - this.ch = ch; - map_address = ch.map_address; - - try - { - long si = ch.size () / 1; - limit ((int) si); - } - catch (IOException e) - { - System.err.println ("failed to get size of file-channel's file"); - } - } - - public MappedByteFileBuffer (MappedByteFileBuffer b) - { - // FIXME: fix last value - super (b.capacity (), b.limit (), b.position (), -1); - - this.readOnly = b.isReadOnly (); - this.ch = b.ch; - map_address = b.map_address; - limit (b.limit ()); - } - - public boolean isReadOnly () - { - return readOnly; - } - - public static native byte nio_read_Byte_file_channel (FileChannelImpl ch, - int index, int limit, - RawData map_address); - public static native void nio_write_Byte_file_channel (FileChannelImpl ch, - int index, int limit, - byte value, - RawData map_address); - public static native short nio_read_Short_file_channel (FileChannelImpl ch, - int index, int limit, - RawData map_address); - public static native void nio_write_Short_file_channel (FileChannelImpl ch, - int index, int limit, - short value, - RawData map_address); - public static native char nio_read_Char_file_channel (FileChannelImpl ch, - int index, int limit, - RawData map_address); - public static native void nio_write_Char_file_channel (FileChannelImpl ch, - int index, int limit, - char value, - RawData map_address); - public static native int nio_read_Int_file_channel (FileChannelImpl ch, - int index, int limit, - RawData map_address); - public static native void nio_write_Int_file_channel (FileChannelImpl ch, - int index, int limit, - int value, - RawData map_address); - public static native long nio_read_Long_file_channel (FileChannelImpl ch, - int index, int limit, - RawData map_address); - public static native void nio_write_Long_file_channel (FileChannelImpl ch, - int index, int limit, - long value, - RawData map_address); - public static native float nio_read_Float_file_channel (FileChannelImpl ch, - int index, int limit, - RawData map_address); - public static native void nio_write_Float_file_channel (FileChannelImpl ch, - int index, int limit, - float value, - RawData map_address); - public static native double - nio_read_Double_file_channel (FileChannelImpl ch, int index, int limit, - RawData map_address); - public static native void nio_write_Double_file_channel (FileChannelImpl ch, - int index, int limit, - double value, - RawData map_address); - - final public byte get () - { - byte a = MappedByteFileBuffer.nio_read_Byte_file_channel (ch, position (), - limit (), - map_address); - position (position () + 1); - return a; - } - - final public ByteBuffer put (byte b) - { - MappedByteFileBuffer.nio_write_Byte_file_channel (ch, position (), limit (), - b, map_address); - position (position () + 1); - return this; - } - - final public byte get (int index) - { - byte a = MappedByteFileBuffer.nio_read_Byte_file_channel (ch, index, - limit (), - map_address); - return a; - } - - final public ByteBuffer put (int index, byte b) - { - MappedByteFileBuffer.nio_write_Byte_file_channel (ch, index, limit (), b, - map_address); - return this; - } - - final public ByteBuffer compact () - { - return this; - } - - final public boolean isDirect () - { - return direct; - } - - final public ByteBuffer slice () - { - MappedByteFileBuffer A = new MappedByteFileBuffer (this); - return A; - } - - public ByteBuffer duplicate () - { - return new MappedByteFileBuffer (this); - } - - public ByteBuffer asReadOnlyBuffer () - { - MappedByteFileBuffer b = new MappedByteFileBuffer (this); - b.readOnly = true; - return b; - } - - final public ByteBuffer asByteBuffer () - { -// ByteBuffer res = new MappedByteFileBuffer (ch); -// res.limit ((limit () * 1) / 1); -// return res; - throw new Error ("not implemented"); - } - - final public byte getByte () - { - byte a = nio_read_Byte_file_channel (ch, position (), limit (), - map_address); - position (position () + 1); - return a; - } - - final public ByteBuffer putByte (byte value) - { - nio_write_Byte_file_channel (ch, position (), limit (), value, map_address); - position (position () + 1); - return this; - } - - final public byte getByte (int index) - { - byte a = nio_read_Byte_file_channel (ch, index, limit(), map_address); - return a; - } - - final public ByteBuffer putByte (int index, byte value) - { - nio_write_Byte_file_channel (ch, index, limit (), value, map_address); - return this; - }; - - final public CharBuffer asCharBuffer () - { -// CharBuffer res = new MappedCharFileBuffer (ch); -// res.limit ((limit () * 1) / 2); -// return res; - throw new Error ("not implemented"); - } - - final public char getChar () - { - char a = nio_read_Char_file_channel (ch, position (), limit (), - map_address); - position (position () + 1); - return a; - } - - final public ByteBuffer putChar (char value) - { - nio_write_Char_file_channel (ch, position (), limit (), value, map_address); - position (position () + 1); - return this; - } - - final public char getChar (int index) - { - char a = nio_read_Char_file_channel (ch, index, limit (), map_address); - return a; - } - - final public ByteBuffer putChar (int index, char value) - { - nio_write_Char_file_channel (ch, index, limit (), value, map_address); - return this; - }; - - final public ShortBuffer asShortBuffer () - { -// ShortBuffer res = new MappedShortFileBuffer (ch); -// res.limit ((limit () * 1) / 2); -// return res; - throw new Error ("not implemented"); - } - - final public short getShort () - { - short a = nio_read_Short_file_channel (ch, position (), limit (), - map_address); - position (position () + 1); - return a; - } - - final public ByteBuffer putShort (short value) - { - nio_write_Short_file_channel (ch, position (), limit (), value, - map_address); - position (position () + 1); - return this; - } - - final public short getShort (int index) - { - short a = nio_read_Short_file_channel (ch, index, limit (), map_address); - return a; - } - - final public ByteBuffer putShort (int index, short value) - { - nio_write_Short_file_channel (ch, index, limit (), value, map_address); - return this; - } - - final public IntBuffer asIntBuffer () - { -// IntBuffer res = new MappedIntFileBuffer (ch); -// res.limit ((limit () * 1) / 4); -// return res; - throw new Error ("not implemented"); - } - - final public int getInt () - { - int a = nio_read_Int_file_channel (ch, position (), limit (), map_address); - position (position () + 1); - return a; - } - - final public ByteBuffer putInt (int value) - { - nio_write_Int_file_channel (ch, position (), limit (), value, map_address); - position (position () + 1); - return this; - } - - final public int getInt (int index) - { - int a = nio_read_Int_file_channel (ch, index, limit (), map_address); - return a; - } - - final public ByteBuffer putInt (int index, int value) - { - nio_write_Int_file_channel (ch, index, limit (), value, map_address); - return this; - } - - final public LongBuffer asLongBuffer () - { -// LongBuffer res = new MappedLongFileBuffer (ch); -// res.limit ((limit () * 1) / 8); -// return res; - throw new Error ("not implemented"); - } - - final public long getLong () - { - long a = nio_read_Long_file_channel (ch, position (), limit (), - map_address); - position (position () + 1); - return a; - } - - final public ByteBuffer putLong (long value) - { - nio_write_Long_file_channel (ch, position (), limit (), value, map_address); - position (position () + 1); - return this; - } - - final public long getLong (int index) - { - long a = nio_read_Long_file_channel (ch, index, limit (), map_address); - return a; - } - - final public ByteBuffer putLong (int index, long value) - { - nio_write_Long_file_channel (ch, index, limit (), value, map_address); - return this; - } - - final public FloatBuffer asFloatBuffer () - { -// FloatBuffer res = new MappedFloatFileBuffer (ch); -// res.limit ((limit () * 1) / 4); -// return res; - throw new Error ("not implemented"); - } - - final public float getFloat () - { - float a = nio_read_Float_file_channel (ch, position (), limit (), - map_address); - position (position () + 1); - return a; - } - - final public ByteBuffer putFloat (float value) - { - nio_write_Float_file_channel (ch, position (), limit (), value, - map_address); - position (position () + 1); - return this; - } - - final public float getFloat (int index) - { - float a = nio_read_Float_file_channel (ch, index, limit (), map_address); - return a; - } - - final public ByteBuffer putFloat (int index, float value) - { - nio_write_Float_file_channel (ch, index, limit (), value, map_address); - return this; - } - - final public DoubleBuffer asDoubleBuffer () - { -// DoubleBuffer res = new MappedDoubleFileBuffer (ch); -// res.limit ((limit () * 1) / 8); -// return res; - throw new Error ("not implemented"); - } - - final public double getDouble () - { - double a = nio_read_Double_file_channel (ch, position (), limit (), - map_address); - position (position () + 1); - return a; - } - - final public ByteBuffer putDouble (double value) - { - nio_write_Double_file_channel (ch, position (), limit (), value, - map_address); - position (position () + 1); - return this; - } - - final public double getDouble (int index) - { - double a = nio_read_Double_file_channel (ch, index, limit (), map_address); - return a; - } - - final public ByteBuffer putDouble (int index, double value) - { - nio_write_Double_file_channel (ch, index, limit (), value, map_address); - return this; - } -} diff --git a/libjava/gnu/java/nio/natMappedByteFileBuffer.cc b/libjava/gnu/java/nio/natMappedByteFileBuffer.cc deleted file mode 100644 index e64e27c8829..00000000000 --- a/libjava/gnu/java/nio/natMappedByteFileBuffer.cc +++ /dev/null @@ -1,148 +0,0 @@ -// natMappedByteFileBuffer.cc - -/* Copyright (C) 2003 Free Software Foundation - - This file is part of libgcj. - -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ - -#include - -#include - -#include -#include -#include - -#ifdef HAVE_UNISTD_H -#include -#endif - -#ifdef HAVE_FCNTL_H -#include -#endif - -#include -#include -#include - -jbyte -gnu::java::nio::MappedByteFileBuffer::nio_read_Byte_file_channel - (gnu::java::nio::FileChannelImpl*, - jint, jint, gnu::gcj::RawData*) -{ - throw new ::java::lang::Error (_Jv_NewStringUTF ("not implemented")); -} - -jchar -gnu::java::nio::MappedByteFileBuffer::nio_read_Char_file_channel - (gnu::java::nio::FileChannelImpl*, - jint, jint, gnu::gcj::RawData*) -{ - throw new ::java::lang::Error (_Jv_NewStringUTF ("not implemented")); -} - -jdouble -gnu::java::nio::MappedByteFileBuffer::nio_read_Double_file_channel - (gnu::java::nio::FileChannelImpl*, - jint, jint, gnu::gcj::RawData*) -{ - throw new ::java::lang::Error (_Jv_NewStringUTF ("not implemented")); -} - -jfloat -gnu::java::nio::MappedByteFileBuffer::nio_read_Float_file_channel - (gnu::java::nio::FileChannelImpl*, - jint, jint, gnu::gcj::RawData*) -{ - throw new ::java::lang::Error (_Jv_NewStringUTF ("not implemented")); -} - -jint -gnu::java::nio::MappedByteFileBuffer::nio_read_Int_file_channel - (gnu::java::nio::FileChannelImpl*, - jint, jint, gnu::gcj::RawData*) -{ - throw new ::java::lang::Error (_Jv_NewStringUTF ("not implemented")); -} - -jlong -gnu::java::nio::MappedByteFileBuffer::nio_read_Long_file_channel - (gnu::java::nio::FileChannelImpl*, - jint, jint, gnu::gcj::RawData*) -{ - throw new ::java::lang::Error (_Jv_NewStringUTF ("not implemented")); -} - -jshort -gnu::java::nio::MappedByteFileBuffer::nio_read_Short_file_channel - (gnu::java::nio::FileChannelImpl*, - jint, jint, gnu::gcj::RawData*) -{ - throw new ::java::lang::Error (_Jv_NewStringUTF ("not implemented")); -} - -void -gnu::java::nio::MappedByteFileBuffer::nio_write_Byte_file_channel - (gnu::java::nio::FileChannelImpl*, - jint, jint, jbyte, - gnu::gcj::RawData*) -{ - throw new ::java::lang::Error (_Jv_NewStringUTF ("not implemented")); -} - -void -gnu::java::nio::MappedByteFileBuffer::nio_write_Char_file_channel - (gnu::java::nio::FileChannelImpl*, - jint, jint, jchar, - gnu::gcj::RawData*) -{ - throw new ::java::lang::Error (_Jv_NewStringUTF ("not implemented")); -} - -void -gnu::java::nio::MappedByteFileBuffer::nio_write_Double_file_channel - (gnu::java::nio::FileChannelImpl*, - jint, jint, jdouble, - gnu::gcj::RawData*) -{ - throw new ::java::lang::Error (_Jv_NewStringUTF ("not implemented")); -} - -void -gnu::java::nio::MappedByteFileBuffer::nio_write_Float_file_channel - (gnu::java::nio::FileChannelImpl*, - jint, jint, jfloat, - gnu::gcj::RawData*) -{ - throw new ::java::lang::Error (_Jv_NewStringUTF ("not implemented")); -} - -void -gnu::java::nio::MappedByteFileBuffer::nio_write_Int_file_channel - (gnu::java::nio::FileChannelImpl*, - jint, jint, jint, - gnu::gcj::RawData*) -{ - throw new ::java::lang::Error (_Jv_NewStringUTF ("not implemented")); -} - -void -gnu::java::nio::MappedByteFileBuffer::nio_write_Long_file_channel - (gnu::java::nio::FileChannelImpl*, - jint, jint, jlong, - gnu::gcj::RawData*) -{ - throw new ::java::lang::Error (_Jv_NewStringUTF ("not implemented")); -} - -void -gnu::java::nio::MappedByteFileBuffer::nio_write_Short_file_channel - (gnu::java::nio::FileChannelImpl*, - jint, jint, jshort, - gnu::gcj::RawData*) -{ - throw new ::java::lang::Error (_Jv_NewStringUTF ("not implemented")); -} diff --git a/libjava/java/nio/MappedByteBufferImpl.java b/libjava/java/nio/MappedByteBufferImpl.java new file mode 100644 index 00000000000..422794872b7 --- /dev/null +++ b/libjava/java/nio/MappedByteBufferImpl.java @@ -0,0 +1,277 @@ +/* MappedByteBufferImpl.java -- + Copyright (C) 2002, 2003 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package java.nio; + +import gnu.java.nio.FileChannelImpl; +import java.io.IOException; +import gnu.gcj.RawData; + +public class MappedByteBufferImpl extends MappedByteBuffer +{ + boolean readOnly; + RawData map_address; + public FileChannelImpl ch; + + public MappedByteBufferImpl (FileChannelImpl ch) throws IOException + { + super ((int) ch.size (), (int) ch.size (), 0, -1); + + this.ch = ch; + map_address = ch.map_address; + long si = ch.size () / 1; + limit ((int) si); + } + + public boolean isReadOnly () + { + return readOnly; + } + + public static byte getImpl (FileChannelImpl ch, int index, + int limit, RawData map_address) + { + throw new Error ("Not implemented"); + } + + public static void putImpl (FileChannelImpl ch, int index, + int limit, byte value, RawData map_address) + { + throw new Error ("Not implemented"); + } + + public byte get () + { + byte result = get (position()); + position (position() + 1); + return result; + } + + public ByteBuffer put (byte value) + { + put (position(), value); + position (position() + 1); + return this; + } + + public byte get (int index) + { + return getImpl (ch, index, limit (), map_address); + } + + public ByteBuffer put (int index, byte value) + { + putImpl (ch, index, limit (), value, map_address); + return this; + } + + public ByteBuffer compact () + { + throw new Error ("Not implemented"); + } + + public boolean isDirect () + { + return true; + } + + public ByteBuffer slice () + { + throw new Error ("Not implemented"); + } + + public ByteBuffer duplicate () + { + throw new Error ("Not implemented"); + } + + public ByteBuffer asReadOnlyBuffer () + { + throw new Error ("Not implemented"); + } + + public CharBuffer asCharBuffer () + { + return new CharViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly ()); + } + + public ShortBuffer asShortBuffer () + { + return new ShortViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly ()); + } + + public IntBuffer asIntBuffer () + { + return new IntViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly ()); + } + + public LongBuffer asLongBuffer () + { + return new LongViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly ()); + } + + public FloatBuffer asFloatBuffer () + { + return new FloatViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly ()); + } + + public DoubleBuffer asDoubleBuffer () + { + return new DoubleViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly ()); + } + + public char getChar () + { + throw new Error ("Not implemented"); + } + + public char getChar (int index) + { + throw new Error ("Not implemented"); + } + + public ByteBuffer putChar (char value) + { + throw new Error ("Not implemented"); + } + + public ByteBuffer putChar (int index, char value) + { + throw new Error ("Not implemented"); + } + + public double getDouble () + { + throw new Error ("Not implemented"); + } + + public double getDouble (int index) + { + throw new Error ("Not implemented"); + } + + public ByteBuffer putDouble (double value) + { + throw new Error ("Not implemented"); + } + + public ByteBuffer putDouble (int index, double value) + { + throw new Error ("Not implemented"); + } + + public float getFloat () + { + throw new Error ("Not implemented"); + } + + public float getFloat (int index) + { + throw new Error ("Not implemented"); + } + + public ByteBuffer putFloat (float value) + { + throw new Error ("Not implemented"); + } + + public ByteBuffer putFloat (int index, float value) + { + throw new Error ("Not implemented"); + } + + public int getInt () + { + throw new Error ("Not implemented"); + } + + public int getInt (int index) + { + throw new Error ("Not implemented"); + } + + public ByteBuffer putInt (int value) + { + throw new Error ("Not implemented"); + } + + public ByteBuffer putInt (int index, int value) + { + throw new Error ("Not implemented"); + } + + public long getLong () + { + throw new Error ("Not implemented"); + } + + public long getLong (int index) + { + throw new Error ("Not implemented"); + } + + public ByteBuffer putLong (long value) + { + throw new Error ("Not implemented"); + } + + public ByteBuffer putLong (int index, long value) + { + throw new Error ("Not implemented"); + } + + public short getShort () + { + throw new Error ("Not implemented"); + } + + public short getShort (int index) + { + throw new Error ("Not implemented"); + } + + public ByteBuffer putShort (short value) + { + throw new Error ("Not implemented"); + } + + public ByteBuffer putShort (int index, short value) + { + throw new Error ("Not implemented"); + } +}