/[classpath]/classpath/gnu/java/nio/MappedCharFileBuffer.java
ViewVC logotype

Diff of /classpath/gnu/java/nio/MappedCharFileBuffer.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by rveldema, Mon Mar 11 16:29:45 2002 UTC revision 1.2 by rveldema, Tue Mar 12 11:36:22 2002 UTC
# Line 1  Line 1 
1  package manta.runtime;  package gnu.java.nio;
2  import java.nio.*;  import java.nio.*;
3  final public class MappedCharFileBuffer  final public class MappedCharFileBuffer
4   extends CharBuffer   extends CharBuffer
5  {  {
6      public long address;
7    boolean ro;    boolean ro;
8    boolean direct;    boolean direct;
9    FileChannelImpl ch;    public FileChannelImpl ch;
10    MappedCharFileBuffer(FileChannelImpl ch)    public MappedCharFileBuffer(FileChannelImpl ch)
11    {    {
12      this.ch = ch;      this.ch = ch;
13        address = ch.address;
14    }    }
15    MappedCharFileBuffer(MappedCharFileBuffer b)    public MappedCharFileBuffer(MappedCharFileBuffer b)
16    {    {
17      this.ro = b.ro;      this.ro = b.ro;
18      this.ch = b.ch;      this.ch = b.ch;
19        address = b.address;
20    }    }
21    boolean isReadOnly()    public boolean isReadOnly()
22    {    {
23      return ro;      return ro;
24    }    }
25  public char get()  final public char get()
26    {    {
27      char a = MappedByteFileBuffer.nio_read_Char_file_channel(ch, pos);      char a = MappedByteFileBuffer.nio_read_Char_file_channel(ch, position());
28      pos += 2;      position(position() + 2);
29      return a;      return a;
30    }    }
31  public CharBuffer put(char b)  final public CharBuffer put(char b)
32    {    {
33      MappedByteFileBuffer.nio_write_Char_file_channel(ch, pos, b);      MappedByteFileBuffer.nio_write_Char_file_channel(ch, position(), b);
34      pos += 2;      position(position() + 2);
35      return this;      return this;
36    }    }
37  public char get(int index)  final public char get(int index)
38    {    {
39      char a = MappedByteFileBuffer.nio_read_Char_file_channel(ch, index);      char a = MappedByteFileBuffer.nio_read_Char_file_channel(ch, index);
40      return a;      return a;
41    }    }
42  public CharBuffer put(int index, char b)  final public CharBuffer put(int index, char b)
43    {    {
44      MappedByteFileBuffer.nio_write_Char_file_channel(ch, index, b);      MappedByteFileBuffer.nio_write_Char_file_channel(ch, index, b);
45      return this;      return this;
46    }    }
47  public CharBuffer compact()  final public CharBuffer compact()
48    {    {
49      return this;      return this;
50    }    }
51  public boolean isDirect()  final public boolean isDirect()
52    {    {
53      return direct;      return direct;
54    }    }
55  public CharBuffer slice()  final public CharBuffer slice()
56    {    {
57      MappedCharFileBuffer A = new MappedCharFileBuffer(this);      MappedCharFileBuffer A = new MappedCharFileBuffer(this);
58      return A;      return A;
# Line 64  public CharBuffer asReadOnlyBuffer() Line 67  public CharBuffer asReadOnlyBuffer()
67      b.ro = true;      b.ro = true;
68      return b;      return b;
69    }    }
70    public ByteBuffer asByteBuffer() { return new MappedByteFileBuffer(ch); } public byte getByte() { byte a = MappedByteFileBuffer.nio_read_Byte_file_channel(ch, pos); pos += 2; return a; } public CharBuffer putByte(byte value) { MappedByteFileBuffer.nio_write_Byte_file_channel(ch, pos, value); pos += 2; return this; } public byte getByte(int index) { byte a = MappedByteFileBuffer.nio_read_Byte_file_channel(ch, index); return a; } public CharBuffer putByte(int index, byte value) { MappedByteFileBuffer.nio_write_Byte_file_channel(ch, index, value); return this; };    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; };
71    public CharBuffer asCharBuffer() { return new MappedCharFileBuffer(ch); } public char getChar() { char a = MappedByteFileBuffer.nio_read_Char_file_channel(ch, pos); pos += 2; return a; } public CharBuffer putChar(char value) { MappedByteFileBuffer.nio_write_Char_file_channel(ch, pos, value); pos += 2; return this; } public char getChar(int index) { char a = MappedByteFileBuffer.nio_read_Char_file_channel(ch, index); return a; } public CharBuffer putChar(int index, char value) { MappedByteFileBuffer.nio_write_Char_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; };
72    public ShortBuffer asShortBuffer() { return new MappedShortFileBuffer(ch); } public short getShort() { short a = MappedByteFileBuffer.nio_read_Short_file_channel(ch, pos); pos += 2; return a; } public CharBuffer putShort(short value) { MappedByteFileBuffer.nio_write_Short_file_channel(ch, pos, value); pos += 2; return this; } public short getShort(int index) { short a = MappedByteFileBuffer.nio_read_Short_file_channel(ch, index); return a; } public CharBuffer putShort(int index, short value) { MappedByteFileBuffer.nio_write_Short_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; };
73    public IntBuffer asIntBuffer() { return new MappedIntFileBuffer(ch); } public int getInt() { int a = MappedByteFileBuffer.nio_read_Int_file_channel(ch, pos); pos += 2; return a; } public CharBuffer putInt(int value) { MappedByteFileBuffer.nio_write_Int_file_channel(ch, pos, value); pos += 2; return this; } public int getInt(int index) { int a = MappedByteFileBuffer.nio_read_Int_file_channel(ch, index); return a; } public CharBuffer putInt(int index, int value) { MappedByteFileBuffer.nio_write_Int_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; };
74    public LongBuffer asLongBuffer() { return new MappedLongFileBuffer(ch); } public long getLong() { long a = MappedByteFileBuffer.nio_read_Long_file_channel(ch, pos); pos += 2; return a; } public CharBuffer putLong(long value) { MappedByteFileBuffer.nio_write_Long_file_channel(ch, pos, value); pos += 2; return this; } public long getLong(int index) { long a = MappedByteFileBuffer.nio_read_Long_file_channel(ch, index); return a; } public CharBuffer putLong(int index, long value) { MappedByteFileBuffer.nio_write_Long_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; };
75    public FloatBuffer asFloatBuffer() { return new MappedFloatFileBuffer(ch); } public float getFloat() { float a = MappedByteFileBuffer.nio_read_Float_file_channel(ch, pos); pos += 2; return a; } public CharBuffer putFloat(float value) { MappedByteFileBuffer.nio_write_Float_file_channel(ch, pos, value); pos += 2; return this; } public float getFloat(int index) { float a = MappedByteFileBuffer.nio_read_Float_file_channel(ch, index); return a; } public CharBuffer putFloat(int index, float value) { MappedByteFileBuffer.nio_write_Float_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; };
76    public DoubleBuffer asDoubleBuffer() { return new MappedDoubleFileBuffer(ch); } public double getDouble() { double a = MappedByteFileBuffer.nio_read_Double_file_channel(ch, pos); pos += 2; return a; } public CharBuffer putDouble(double value) { MappedByteFileBuffer.nio_write_Double_file_channel(ch, pos, value); pos += 2; return this; } public double getDouble(int index) { double a = MappedByteFileBuffer.nio_read_Double_file_channel(ch, index); return a; } public CharBuffer putDouble(int index, double value) { MappedByteFileBuffer.nio_write_Double_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; };
77  }  }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26