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

Diff of /classpath/gnu/java/nio/ByteBufferImpl.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  public final class ByteBufferImpl extends java.nio. ByteBuffer  public final class ByteBufferImpl extends java.nio. ByteBuffer
4  {  {
5      private int array_offset;      private int array_offset;
6      byte [] backing_buffer;      byte [] backing_buffer;
7      private boolean ro;      private boolean ro;
8      ByteBufferImpl(int cap, int off, int lim)    public ByteBufferImpl(int cap, int off, int lim)
9      {      {
10        this.backing_buffer = new byte[cap];        this.backing_buffer = new byte[cap];
11        this.cap = cap;        this.capacity(cap);
12        this.pos = off;        this.position(off);
13        this.limit = lim;        this.limit(lim);
14      }      }
15      ByteBufferImpl(byte[] array, int off, int lim)    public ByteBufferImpl(byte[] array, int off, int lim)
16      {      {
17        this.backing_buffer = array;        this.backing_buffer = array;
18        this.cap = array.length;        this.capacity(array.length);
19        this.pos = off;        this.position(off);
20        this.limit = lim;        this.limit(lim);
21      }      }
22      ByteBufferImpl(ByteBufferImpl copy)    public ByteBufferImpl(ByteBufferImpl copy)
23      {      {
24          backing_buffer = copy.backing_buffer;          backing_buffer = copy.backing_buffer;
25          ro = copy.ro;          ro = copy.ro;
26          pos = copy.pos;          position(copy.position());
27          limit = copy.limit;          limit(copy.limit());
28      }      }
29      void inc_pos(int a)      void inc_pos(int a)
30      {      {
31          pos += a;        position(position() + a);
32      }      }
33    private static MantaNative byte[] nio_cast(byte[]copy);    private static native byte[] nio_cast(byte[]copy);
34    private static MantaNative byte[] nio_cast(char[]copy);    private static native byte[] nio_cast(char[]copy);
35    private static MantaNative byte[] nio_cast(short[]copy);    private static native byte[] nio_cast(short[]copy);
36    private static MantaNative byte[] nio_cast(long[]copy);    private static native byte[] nio_cast(long[]copy);
37    private static MantaNative byte[] nio_cast(int[]copy);    private static native byte[] nio_cast(int[]copy);
38    private static MantaNative byte[] nio_cast(float[]copy);    private static native byte[] nio_cast(float[]copy);
39    private static MantaNative byte[] nio_cast(double[]copy);    private static native byte[] nio_cast(double[]copy);
40    ByteBufferImpl(byte[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; } private static MantaNative byte nio_get_Byte(ByteBufferImpl b, int index); private static MantaNative void nio_put_Byte(ByteBufferImpl b, int index, byte value); public java.nio. ByteBuffer asByteBuffer() { return new manta.runtime. ByteBufferImpl(backing_buffer); }    ByteBufferImpl(byte[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; } private static native byte nio_get_Byte(ByteBufferImpl b, int index); private static native void nio_put_Byte(ByteBufferImpl b, int index, byte value); public java.nio. ByteBuffer asByteBuffer() { return new gnu.java.nio. ByteBufferImpl(backing_buffer); }
41    ByteBufferImpl(char[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; } private static MantaNative char nio_get_Char(ByteBufferImpl b, int index); private static MantaNative void nio_put_Char(ByteBufferImpl b, int index, char value); public java.nio. CharBuffer asCharBuffer() { return new manta.runtime. CharBufferImpl(backing_buffer); }    ByteBufferImpl(char[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; } private static native char nio_get_Char(ByteBufferImpl b, int index); private static native void nio_put_Char(ByteBufferImpl b, int index, char value); public java.nio. CharBuffer asCharBuffer() { return new gnu.java.nio. CharBufferImpl(backing_buffer); }
42    ByteBufferImpl(short[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; } private static MantaNative short nio_get_Short(ByteBufferImpl b, int index); private static MantaNative void nio_put_Short(ByteBufferImpl b, int index, short value); public java.nio. ShortBuffer asShortBuffer() { return new manta.runtime. ShortBufferImpl(backing_buffer); }    ByteBufferImpl(short[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; } private static native short nio_get_Short(ByteBufferImpl b, int index); private static native void nio_put_Short(ByteBufferImpl b, int index, short value); public java.nio. ShortBuffer asShortBuffer() { return new gnu.java.nio. ShortBufferImpl(backing_buffer); }
43    ByteBufferImpl(int[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; } private static MantaNative int nio_get_Int(ByteBufferImpl b, int index); private static MantaNative void nio_put_Int(ByteBufferImpl b, int index, int value); public java.nio. IntBuffer asIntBuffer() { return new manta.runtime. IntBufferImpl(backing_buffer); }    ByteBufferImpl(int[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; } private static native int nio_get_Int(ByteBufferImpl b, int index); private static native void nio_put_Int(ByteBufferImpl b, int index, int value); public java.nio. IntBuffer asIntBuffer() { return new gnu.java.nio. IntBufferImpl(backing_buffer); }
44    ByteBufferImpl(long[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; } private static MantaNative long nio_get_Long(ByteBufferImpl b, int index); private static MantaNative void nio_put_Long(ByteBufferImpl b, int index, long value); public java.nio. LongBuffer asLongBuffer() { return new manta.runtime. LongBufferImpl(backing_buffer); }    ByteBufferImpl(long[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; } private static native long nio_get_Long(ByteBufferImpl b, int index); private static native void nio_put_Long(ByteBufferImpl b, int index, long value); public java.nio. LongBuffer asLongBuffer() { return new gnu.java.nio. LongBufferImpl(backing_buffer); }
45    ByteBufferImpl(float[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; } private static MantaNative float nio_get_Float(ByteBufferImpl b, int index); private static MantaNative void nio_put_Float(ByteBufferImpl b, int index, float value); public java.nio. FloatBuffer asFloatBuffer() { return new manta.runtime. FloatBufferImpl(backing_buffer); }    ByteBufferImpl(float[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; } private static native float nio_get_Float(ByteBufferImpl b, int index); private static native void nio_put_Float(ByteBufferImpl b, int index, float value); public java.nio. FloatBuffer asFloatBuffer() { return new gnu.java.nio. FloatBufferImpl(backing_buffer); }
46    ByteBufferImpl(double[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; } private static MantaNative double nio_get_Double(ByteBufferImpl b, int index); private static MantaNative void nio_put_Double(ByteBufferImpl b, int index, double value); public java.nio. DoubleBuffer asDoubleBuffer() { return new manta.runtime. DoubleBufferImpl(backing_buffer); }    ByteBufferImpl(double[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; } private static native double nio_get_Double(ByteBufferImpl b, int index); private static native void nio_put_Double(ByteBufferImpl b, int index, double value); public java.nio. DoubleBuffer asDoubleBuffer() { return new gnu.java.nio. DoubleBufferImpl(backing_buffer); }
47      public boolean isReadOnly()      public boolean isReadOnly()
48      {      {
49          return ro;          return ro;
# Line 51  public final class ByteBufferImpl extend Line 51  public final class ByteBufferImpl extend
51      public java.nio. ByteBuffer slice()      public java.nio. ByteBuffer slice()
52      {      {
53          ByteBufferImpl A = new ByteBufferImpl(this);          ByteBufferImpl A = new ByteBufferImpl(this);
54          A.array_offset = pos;          A.array_offset = position();
55          return A;          return A;
56      }      }
57      public java.nio. ByteBuffer duplicate()      public java.nio. ByteBuffer duplicate()
# Line 72  public final class ByteBufferImpl extend Line 72  public final class ByteBufferImpl extend
72      {      {
73          return backing_buffer != null;          return backing_buffer != null;
74      }      }
75      public byte get()    final public byte get()
76      {      {
77          byte e = backing_buffer[pos];          byte e = backing_buffer[position()];
78          pos++;          position(position()+1);
79          return e;          return e;
80      }      }
81      public java.nio. ByteBuffer put(byte b)    final public java.nio. ByteBuffer put(byte b)
82      {      {
83          backing_buffer[pos] = b;          backing_buffer[position()] = b;
84          pos++;          position(position()+1);
85          return this;          return this;
86      }      }
87      public byte get(int index)    final public byte get(int index)
88      {      {
89          return backing_buffer[index];          return backing_buffer[index];
90      }      }
91      public java.nio. ByteBuffer put(int index, byte b)     final public java.nio. ByteBuffer put(int index, byte b)
92      {      {
93        backing_buffer[index] = b;        backing_buffer[index] = b;
94        return this;        return this;
95      }      }
96    public char getChar() { char a = nio_get_Char(this, pos); inc_pos(2); return a; } public java.nio. ByteBuffer putChar(char value) { nio_put_Char(this, pos, value); inc_pos(2); return this; } public char getChar(int index) { char a = nio_get_Char(this, index); inc_pos(2); return a; } public java.nio. ByteBuffer putChar(int index, char value) { nio_put_Char(this, index, value); inc_pos(2); return this; };    final public char getChar() { char a = nio_get_Char(this, position()); inc_pos(2); return a; } final public java.nio. ByteBuffer putChar(char value) { nio_put_Char(this, position(), value); inc_pos(2); return this; } final public char getChar(int index) { char a = nio_get_Char(this, index); return a; } final public java.nio. ByteBuffer putChar(int index, char value) { nio_put_Char(this, index, value); return this; };
97    public short getShort() { short a = nio_get_Short(this, pos); inc_pos(2); return a; } public java.nio. ByteBuffer putShort(short value) { nio_put_Short(this, pos, value); inc_pos(2); return this; } public short getShort(int index) { short a = nio_get_Short(this, index); inc_pos(2); return a; } public java.nio. ByteBuffer putShort(int index, short value) { nio_put_Short(this, index, value); inc_pos(2); return this; };    final public short getShort() { short a = nio_get_Short(this, position()); inc_pos(2); return a; } final public java.nio. ByteBuffer putShort(short value) { nio_put_Short(this, position(), value); inc_pos(2); return this; } final public short getShort(int index) { short a = nio_get_Short(this, index); return a; } final public java.nio. ByteBuffer putShort(int index, short value) { nio_put_Short(this, index, value); return this; };
98    public int getInt() { int a = nio_get_Int(this, pos); inc_pos(4); return a; } public java.nio. ByteBuffer putInt(int value) { nio_put_Int(this, pos, value); inc_pos(4); return this; } public int getInt(int index) { int a = nio_get_Int(this, index); inc_pos(4); return a; } public java.nio. ByteBuffer putInt(int index, int value) { nio_put_Int(this, index, value); inc_pos(4); return this; };    final public int getInt() { int a = nio_get_Int(this, position()); inc_pos(4); return a; } final public java.nio. ByteBuffer putInt(int value) { nio_put_Int(this, position(), value); inc_pos(4); return this; } final public int getInt(int index) { int a = nio_get_Int(this, index); return a; } final public java.nio. ByteBuffer putInt(int index, int value) { nio_put_Int(this, index, value); return this; };
99    public long getLong() { long a = nio_get_Long(this, pos); inc_pos(8); return a; } public java.nio. ByteBuffer putLong(long value) { nio_put_Long(this, pos, value); inc_pos(8); return this; } public long getLong(int index) { long a = nio_get_Long(this, index); inc_pos(8); return a; } public java.nio. ByteBuffer putLong(int index, long value) { nio_put_Long(this, index, value); inc_pos(8); return this; };    final public long getLong() { long a = nio_get_Long(this, position()); inc_pos(8); return a; } final public java.nio. ByteBuffer putLong(long value) { nio_put_Long(this, position(), value); inc_pos(8); return this; } final public long getLong(int index) { long a = nio_get_Long(this, index); return a; } final public java.nio. ByteBuffer putLong(int index, long value) { nio_put_Long(this, index, value); return this; };
100    public float getFloat() { float a = nio_get_Float(this, pos); inc_pos(4); return a; } public java.nio. ByteBuffer putFloat(float value) { nio_put_Float(this, pos, value); inc_pos(4); return this; } public float getFloat(int index) { float a = nio_get_Float(this, index); inc_pos(4); return a; } public java.nio. ByteBuffer putFloat(int index, float value) { nio_put_Float(this, index, value); inc_pos(4); return this; };    final public float getFloat() { float a = nio_get_Float(this, position()); inc_pos(4); return a; } final public java.nio. ByteBuffer putFloat(float value) { nio_put_Float(this, position(), value); inc_pos(4); return this; } final public float getFloat(int index) { float a = nio_get_Float(this, index); return a; } final public java.nio. ByteBuffer putFloat(int index, float value) { nio_put_Float(this, index, value); return this; };
101    public double getDouble() { double a = nio_get_Double(this, pos); inc_pos(8); return a; } public java.nio. ByteBuffer putDouble(double value) { nio_put_Double(this, pos, value); inc_pos(8); return this; } public double getDouble(int index) { double a = nio_get_Double(this, index); inc_pos(8); return a; } public java.nio. ByteBuffer putDouble(int index, double value) { nio_put_Double(this, index, value); inc_pos(8); return this; };    final public double getDouble() { double a = nio_get_Double(this, position()); inc_pos(8); return a; } final public java.nio. ByteBuffer putDouble(double value) { nio_put_Double(this, position(), value); inc_pos(8); return this; } final public double getDouble(int index) { double a = nio_get_Double(this, index); return a; } final public java.nio. ByteBuffer putDouble(int index, double value) { nio_put_Double(this, index, value); return this; };
102  }  }

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