diff options
author | Brian Jones <cbj@gnu.org> | 2002-03-13 13:05:22 +0000 |
---|---|---|
committer | Brian Jones <cbj@gnu.org> | 2002-03-13 13:05:22 +0000 |
commit | 62f93952c1fbfa02bd9a204a85cf5df41adace86 (patch) | |
tree | a15ab8ee6538dfaf926b4901698842e50c0fd6ac /gnu/java/nio/MappedCharFileBuffer.java | |
parent | f0a25669f4c9be51680ffefe5967c0c47fbc7704 (diff) | |
download | classpath-62f93952c1fbfa02bd9a204a85cf5df41adace86.tar.gz |
* lib/gen_nio.sh.in: new file is renamed gen_nio.sh plus fixes
to make it work when building outside of the classpath directory
* lib/gen_nio.sh: removed file
* lib/.cvsignore: ignore gen_nio.sh
* configure.in: generate gen_nio.sh and nio related Makefiles
in OUTPUT. Revert comment out of check for libart_lgpl
* lib/Makefile.am: give gen_nio.sh some idea of the top_builddir
and make it a separate target, gennio, that must be manually
executed; the generated files will be part of CVS since they change
only when the source .cpp changes rather than due to a configuration
change
* java/nio/Makefile.am: new file
* java/nio/.cvsignore: new file
* java/nio/charset/Makefile.am: new file
* java/nio/charset/.cvsignore: new file
* java/nio/channels/Makefile.am: new file
* java/nio/channels/.cvsignore: new file
* java/nio/channels/spi/Makefile.am: new file
* java/nio/channels/spi/.cvsignore: new file
* gnu/java/nio/Makefile.am: new file
* gnu/java/nio/.cvsignore: new file
* java/nio/ShortBuffer.java: generated file
* java/nio/ByteBuffer.java: generated file
* java/nio/LongBuffer.java: generated file
* java/nio/IntBuffer.java: generated file
* java/nio/FloatBuffer.java: generated file
* java/nio/DoubleBuffer.java: generated file
* java/nio/CharBuffer.java: generated file
* gnu/java/nio/ShortBufferImpl.java: generated file
* gnu/java/nio/MappedShortFileBuffer.java: generated file
* gnu/java/nio/MappedLongFileBuffer.java: generated file
* gnu/java/nio/MappedIntFileBuffer.java: generated file
* gnu/java/nio/MappedFloatFileBuffer.java: generated file
* gnu/java/nio/MappedDoubleFileBuffer.java: generated file
* gnu/java/nio/MappedCharFileBuffer.java: generated file
* gnu/java/nio/MappedByteFileBuffer.java: generated file
* gnu/java/nio/LongBufferImpl.java: generated file
* gnu/java/nio/IntBufferImpl.java: generated file
* gnu/java/nio/FloatBufferImpl.java: generated file
* gnu/java/nio/DoubleBufferImpl.java: generated file
* gnu/java/nio/CharBufferImpl.java: generated file
* gnu/java/nio/ByteBufferImpl.java: generated file
Diffstat (limited to 'gnu/java/nio/MappedCharFileBuffer.java')
-rw-r--r-- | gnu/java/nio/MappedCharFileBuffer.java | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/gnu/java/nio/MappedCharFileBuffer.java b/gnu/java/nio/MappedCharFileBuffer.java new file mode 100644 index 000000000..6b46c077a --- /dev/null +++ b/gnu/java/nio/MappedCharFileBuffer.java @@ -0,0 +1,77 @@ +package gnu.java.nio; +import java.nio.*; +final public class MappedCharFileBuffer + extends CharBuffer +{ + public long address; + boolean ro; + boolean direct; + public FileChannelImpl ch; + public MappedCharFileBuffer(FileChannelImpl ch) + { + this.ch = ch; + address = ch.address; + } + public MappedCharFileBuffer(MappedCharFileBuffer b) + { + this.ro = b.ro; + this.ch = b.ch; + address = b.address; + } + public boolean isReadOnly() + { + return ro; + } +final public char get() + { + char a = MappedByteFileBuffer.nio_read_Char_file_channel(ch, position()); + position(position() + 2); + return a; + } +final public CharBuffer put(char b) + { + MappedByteFileBuffer.nio_write_Char_file_channel(ch, position(), b); + position(position() + 2); + return this; + } +final public char get(int index) + { + char a = MappedByteFileBuffer.nio_read_Char_file_channel(ch, index); + return a; + } +final public CharBuffer put(int index, char b) + { + MappedByteFileBuffer.nio_write_Char_file_channel(ch, index, b); + return this; + } +final public CharBuffer compact() + { + return this; + } +final public boolean isDirect() + { + return direct; + } +final public CharBuffer slice() + { + MappedCharFileBuffer A = new MappedCharFileBuffer(this); + return A; + } +public CharBuffer duplicate() + { + return new MappedCharFileBuffer(this); + } +public CharBuffer asReadOnlyBuffer() + { + MappedCharFileBuffer b = new MappedCharFileBuffer(this); + b.ro = true; + return b; + } + final public ByteBuffer asByteBuffer() { return new MappedByteFileBuffer(ch); } final public byte getByte() { byte a = MappedByteFileBuffer.nio_read_Byte_file_channel(ch, position()); position(position() + 2); return a; } final public CharBuffer putByte(byte value) { MappedByteFileBuffer.nio_write_Byte_file_channel(ch, position(), value); position(position() + 2); return this; } final public byte getByte(int index) { byte a = MappedByteFileBuffer.nio_read_Byte_file_channel(ch, index); return a; } final public CharBuffer putByte(int index, byte value) { MappedByteFileBuffer.nio_write_Byte_file_channel(ch, index, value); return this; }; + final public CharBuffer asCharBuffer() { return new MappedCharFileBuffer(ch); } final public char getChar() { char a = MappedByteFileBuffer.nio_read_Char_file_channel(ch, position()); position(position() + 2); return a; } final public CharBuffer putChar(char value) { MappedByteFileBuffer.nio_write_Char_file_channel(ch, position(), value); position(position() + 2); return this; } final public char getChar(int index) { char a = MappedByteFileBuffer.nio_read_Char_file_channel(ch, index); return a; } final public CharBuffer putChar(int index, char value) { MappedByteFileBuffer.nio_write_Char_file_channel(ch, index, value); return this; }; + final public ShortBuffer asShortBuffer() { return new MappedShortFileBuffer(ch); } final public short getShort() { short a = MappedByteFileBuffer.nio_read_Short_file_channel(ch, position()); position(position() + 2); return a; } final public CharBuffer putShort(short value) { MappedByteFileBuffer.nio_write_Short_file_channel(ch, position(), value); position(position() + 2); return this; } final public short getShort(int index) { short a = MappedByteFileBuffer.nio_read_Short_file_channel(ch, index); return a; } final public CharBuffer putShort(int index, short value) { MappedByteFileBuffer.nio_write_Short_file_channel(ch, index, value); return this; }; + final public IntBuffer asIntBuffer() { return new MappedIntFileBuffer(ch); } final public int getInt() { int a = MappedByteFileBuffer.nio_read_Int_file_channel(ch, position()); position(position() + 2); return a; } final public CharBuffer putInt(int value) { MappedByteFileBuffer.nio_write_Int_file_channel(ch, position(), value); position(position() + 2); return this; } final public int getInt(int index) { int a = MappedByteFileBuffer.nio_read_Int_file_channel(ch, index); return a; } final public CharBuffer putInt(int index, int value) { MappedByteFileBuffer.nio_write_Int_file_channel(ch, index, value); return this; }; + final public LongBuffer asLongBuffer() { return new MappedLongFileBuffer(ch); } final public long getLong() { long a = MappedByteFileBuffer.nio_read_Long_file_channel(ch, position()); position(position() + 2); return a; } final public CharBuffer putLong(long value) { MappedByteFileBuffer.nio_write_Long_file_channel(ch, position(), value); position(position() + 2); return this; } final public long getLong(int index) { long a = MappedByteFileBuffer.nio_read_Long_file_channel(ch, index); return a; } final public CharBuffer putLong(int index, long value) { MappedByteFileBuffer.nio_write_Long_file_channel(ch, index, value); return this; }; + final public FloatBuffer asFloatBuffer() { return new MappedFloatFileBuffer(ch); } final public float getFloat() { float a = MappedByteFileBuffer.nio_read_Float_file_channel(ch, position()); position(position() + 2); return a; } final public CharBuffer putFloat(float value) { MappedByteFileBuffer.nio_write_Float_file_channel(ch, position(), value); position(position() + 2); return this; } final public float getFloat(int index) { float a = MappedByteFileBuffer.nio_read_Float_file_channel(ch, index); return a; } final public CharBuffer putFloat(int index, float value) { MappedByteFileBuffer.nio_write_Float_file_channel(ch, index, value); return this; }; + final public DoubleBuffer asDoubleBuffer() { return new MappedDoubleFileBuffer(ch); } final public double getDouble() { double a = MappedByteFileBuffer.nio_read_Double_file_channel(ch, position()); position(position() + 2); return a; } final public CharBuffer putDouble(double value) { MappedByteFileBuffer.nio_write_Double_file_channel(ch, position(), value); position(position() + 2); return this; } final public double getDouble(int index) { double a = MappedByteFileBuffer.nio_read_Double_file_channel(ch, index); return a; } final public CharBuffer putDouble(int index, double value) { MappedByteFileBuffer.nio_write_Double_file_channel(ch, index, value); return this; }; +} |