/[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.8 by mkoch, Sun Nov 17 12:21:36 2002 UTC revision 1.9 by mkoch, Tue Nov 19 11:21:34 2002 UTC
# Line 38  exception statement from your version. * Line 38  exception statement from your version. *
38  package gnu.java.nio;  package gnu.java.nio;
39    
40  import java.nio.ByteBuffer;  import java.nio.ByteBuffer;
41    import java.nio.CharBuffer;
42    import java.nio.DoubleBuffer;
43    import java.nio.FloatBuffer;
44    import java.nio.IntBuffer;
45    import java.nio.LongBuffer;
46    import java.nio.ShortBuffer;
47    
48  public final class ByteBufferImpl extends ByteBuffer  public final class ByteBufferImpl extends ByteBuffer
49  {  {
# Line 76  public final class ByteBufferImpl extend Line 82  public final class ByteBufferImpl extend
82    }    }
83    
84    private static native byte[] nio_cast(byte[]copy);    private static native byte[] nio_cast(byte[]copy);
     
85    private static native byte[] nio_cast(char[]copy);    private static native byte[] nio_cast(char[]copy);
     
86    private static native byte[] nio_cast(short[]copy);    private static native byte[] nio_cast(short[]copy);
     
87    private static native byte[] nio_cast(long[]copy);    private static native byte[] nio_cast(long[]copy);
     
88    private static native byte[] nio_cast(int[]copy);    private static native byte[] nio_cast(int[]copy);
     
89    private static native byte[] nio_cast(float[]copy);    private static native byte[] nio_cast(float[]copy);
     
90    private static native byte[] nio_cast(double[]copy);    private static native byte[] nio_cast(double[]copy);
91    ByteBufferImpl(byte[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; } private static native byte nio_get_Byte(ByteBufferImpl b, int index, int limit); private static native void nio_put_Byte(ByteBufferImpl b, int index, int limit, byte value); public java.nio. ByteBuffer asByteBuffer() { gnu.java.nio. ByteBufferImpl res = new gnu.java.nio. ByteBufferImpl(backing_buffer); res.limit((limit()*1)/1); return res; }  
92    ByteBufferImpl(char[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; } private static native char nio_get_Char(ByteBufferImpl b, int index, int limit); private static native void nio_put_Char(ByteBufferImpl b, int index, int limit, char value); public java.nio. CharBuffer asCharBuffer() { gnu.java.nio. CharBufferImpl res = new gnu.java.nio. CharBufferImpl(backing_buffer); res.limit((limit()*2)/1); return res; }    ByteBufferImpl(byte[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; } private static native byte nio_get_Byte(ByteBufferImpl b, int index, int limit); private static native void nio_put_Byte(ByteBufferImpl b, int index, int limit, byte value); public ByteBuffer asByteBuffer() { ByteBufferImpl res = new ByteBufferImpl(backing_buffer); res.limit((limit()*1)/1); return res; }
93    ByteBufferImpl(short[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; } private static native short nio_get_Short(ByteBufferImpl b, int index, int limit); private static native void nio_put_Short(ByteBufferImpl b, int index, int limit, short value); public java.nio. ShortBuffer asShortBuffer() { gnu.java.nio. ShortBufferImpl res = new gnu.java.nio. ShortBufferImpl(backing_buffer); res.limit((limit()*2)/1); return res; }    ByteBufferImpl(char[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; } private static native char nio_get_Char(ByteBufferImpl b, int index, int limit); private static native void nio_put_Char(ByteBufferImpl b, int index, int limit, char value); public CharBuffer asCharBuffer() { CharBufferImpl res = new CharBufferImpl(backing_buffer); res.limit((limit()*2)/1); return res; }
94    ByteBufferImpl(int[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; } private static native int nio_get_Int(ByteBufferImpl b, int index, int limit); private static native void nio_put_Int(ByteBufferImpl b, int index, int limit, int value); public java.nio. IntBuffer asIntBuffer() { gnu.java.nio. IntBufferImpl res = new gnu.java.nio. IntBufferImpl(backing_buffer); res.limit((limit()*4)/1); return res; }    ByteBufferImpl(short[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; } private static native short nio_get_Short(ByteBufferImpl b, int index, int limit); private static native void nio_put_Short(ByteBufferImpl b, int index, int limit, short value); public ShortBuffer asShortBuffer() { ShortBufferImpl res = new ShortBufferImpl(backing_buffer); res.limit((limit()*2)/1); return res; }
95    ByteBufferImpl(long[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; } private static native long nio_get_Long(ByteBufferImpl b, int index, int limit); private static native void nio_put_Long(ByteBufferImpl b, int index, int limit, long value); public java.nio. LongBuffer asLongBuffer() { gnu.java.nio. LongBufferImpl res = new gnu.java.nio. LongBufferImpl(backing_buffer); res.limit((limit()*8)/1); return res; }    ByteBufferImpl(int[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; } private static native int nio_get_Int(ByteBufferImpl b, int index, int limit); private static native void nio_put_Int(ByteBufferImpl b, int index, int limit, int value); public IntBuffer asIntBuffer() { IntBufferImpl res = new IntBufferImpl(backing_buffer); res.limit((limit()*4)/1); return res; }
96    ByteBufferImpl(float[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; } private static native float nio_get_Float(ByteBufferImpl b, int index, int limit); private static native void nio_put_Float(ByteBufferImpl b, int index, int limit, float value); public java.nio. FloatBuffer asFloatBuffer() { gnu.java.nio. FloatBufferImpl res = new gnu.java.nio. FloatBufferImpl(backing_buffer); res.limit((limit()*4)/1); return res; }    ByteBufferImpl(long[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; } private static native long nio_get_Long(ByteBufferImpl b, int index, int limit); private static native void nio_put_Long(ByteBufferImpl b, int index, int limit, long value); public LongBuffer asLongBuffer() { LongBufferImpl res = new LongBufferImpl(backing_buffer); res.limit((limit()*8)/1); return res; }
97    ByteBufferImpl(double[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; } private static native double nio_get_Double(ByteBufferImpl b, int index, int limit); private static native void nio_put_Double(ByteBufferImpl b, int index, int limit, double value); public java.nio. DoubleBuffer asDoubleBuffer() { gnu.java.nio. DoubleBufferImpl res = new gnu.java.nio. DoubleBufferImpl(backing_buffer); res.limit((limit()*8)/1); return res; }    ByteBufferImpl(float[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; } private static native float nio_get_Float(ByteBufferImpl b, int index, int limit); private static native void nio_put_Float(ByteBufferImpl b, int index, int limit, float value); public FloatBuffer asFloatBuffer() { FloatBufferImpl res = new FloatBufferImpl(backing_buffer); res.limit((limit()*4)/1); return res; }
98      public boolean isReadOnly()    ByteBufferImpl(double[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; } private static native double nio_get_Double(ByteBufferImpl b, int index, int limit); private static native void nio_put_Double(ByteBufferImpl b, int index, int limit, double value); public DoubleBuffer asDoubleBuffer() { DoubleBufferImpl res = new DoubleBufferImpl(backing_buffer); res.limit((limit()*8)/1); return res; }
99      {  
100          return ro;    public boolean isReadOnly()
101      }    {
102      public java.nio. ByteBuffer slice()      return ro;
103      {    }
104          ByteBufferImpl A = new ByteBufferImpl(this);    
105          A.array_offset = position();    public ByteBuffer slice()
106          return A;    {
107      }      ByteBufferImpl A = new ByteBufferImpl(this);
108      public java.nio. ByteBuffer duplicate()      A.array_offset = position();
109      {      return A;
110          return new ByteBufferImpl(this);    }
111      }  
112      public java.nio. ByteBuffer asReadOnlyBuffer()    public ByteBuffer duplicate()
113      {    {
114          ByteBufferImpl a = new ByteBufferImpl(this);      return new ByteBufferImpl(this);
115          a.ro = true;    }
116          return a;  
117      }    public ByteBuffer asReadOnlyBuffer()
118      public java.nio. ByteBuffer compact()    {
119      {      ByteBufferImpl a = new ByteBufferImpl(this);
120          return this;      a.ro = true;
121      }      return a;
122      public boolean isDirect()    }
123      {  
124          return backing_buffer != null;    public ByteBuffer compact()
125      }    {
126        return this;
127      }
128    
129      public boolean isDirect()
130      {
131        return backing_buffer != null;
132      }
133      
134    final public byte get()    final public byte get()
135    {    {
136      byte e = backing_buffer[position()];      byte e = backing_buffer[position()];
# Line 138  public final class ByteBufferImpl extend Line 146  public final class ByteBufferImpl extend
146    }    }
147        
148    final public byte get(int index)    final public byte get(int index)
149      {    {
150          return backing_buffer[index];      return backing_buffer[index];
151      }    }
152     final public java.nio. ByteBuffer put(int index, byte b)    
153      {    final public ByteBuffer put(int index, byte b)
154        backing_buffer[index] = b;    {
155        return this;      backing_buffer[index] = b;
156      }      return this;
157    final public char getChar() { char a = nio_get_Char(this, position(), limit()); inc_pos(2); return a; } final public java.nio. ByteBuffer putChar(char value) { nio_put_Char(this, position(), limit(), value); inc_pos(2); return this; } final public char getChar(int index) { char a = nio_get_Char(this, index, limit()); return a; } final public java.nio. ByteBuffer putChar(int index, char value) { nio_put_Char(this, index, limit(), value); return this; };    }
158    final public short getShort() { short a = nio_get_Short(this, position(), limit()); inc_pos(2); return a; } final public java.nio. ByteBuffer putShort(short value) { nio_put_Short(this, position(), limit(), value); inc_pos(2); return this; } final public short getShort(int index) { short a = nio_get_Short(this, index, limit()); return a; } final public java.nio. ByteBuffer putShort(int index, short value) { nio_put_Short(this, index, limit(), value); return this; };    
159    final public int getInt() { int a = nio_get_Int(this, position(), limit()); inc_pos(4); return a; } final public java.nio. ByteBuffer putInt(int value) { nio_put_Int(this, position(), limit(), value); inc_pos(4); return this; } final public int getInt(int index) { int a = nio_get_Int(this, index, limit()); return a; } final public java.nio. ByteBuffer putInt(int index, int value) { nio_put_Int(this, index, limit(), value); return this; };    final public char getChar() { char a = nio_get_Char(this, position(), limit()); inc_pos(2); return a; } final public ByteBuffer putChar(char value) { nio_put_Char(this, position(), limit(), value); inc_pos(2); return this; } final public char getChar(int index) { char a = nio_get_Char(this, index, limit()); return a; } final public ByteBuffer putChar(int index, char value) { nio_put_Char(this, index, limit(), value); return this; };
160    final public long getLong() { long a = nio_get_Long(this, position(), limit()); inc_pos(8); return a; } final public java.nio. ByteBuffer putLong(long value) { nio_put_Long(this, position(), limit(), value); inc_pos(8); return this; } final public long getLong(int index) { long a = nio_get_Long(this, index, limit()); return a; } final public java.nio. ByteBuffer putLong(int index, long value) { nio_put_Long(this, index, limit(), value); return this; };    final public short getShort() { short a = nio_get_Short(this, position(), limit()); inc_pos(2); return a; } final public ByteBuffer putShort(short value) { nio_put_Short(this, position(), limit(), value); inc_pos(2); return this; } final public short getShort(int index) { short a = nio_get_Short(this, index, limit()); return a; } final public ByteBuffer putShort(int index, short value) { nio_put_Short(this, index, limit(), value); return this; };
161    final public float getFloat() { float a = nio_get_Float(this, position(), limit()); inc_pos(4); return a; } final public java.nio. ByteBuffer putFloat(float value) { nio_put_Float(this, position(), limit(), value); inc_pos(4); return this; } final public float getFloat(int index) { float a = nio_get_Float(this, index, limit()); return a; } final public java.nio. ByteBuffer putFloat(int index, float value) { nio_put_Float(this, index, limit(), value); return this; };    final public int getInt() { int a = nio_get_Int(this, position(), limit()); inc_pos(4); return a; } final public ByteBuffer putInt(int value) { nio_put_Int(this, position(), limit(), value); inc_pos(4); return this; } final public int getInt(int index) { int a = nio_get_Int(this, index, limit()); return a; } final public ByteBuffer putInt(int index, int value) { nio_put_Int(this, index, limit(), value); return this; };
162    final public double getDouble() { double a = nio_get_Double(this, position(), limit()); inc_pos(8); return a; } final public java.nio. ByteBuffer putDouble(double value) { nio_put_Double(this, position(), limit(), value); inc_pos(8); return this; } final public double getDouble(int index) { double a = nio_get_Double(this, index, limit()); return a; } final public java.nio. ByteBuffer putDouble(int index, double value) { nio_put_Double(this, index, limit(), value); return this; };    final public long getLong() { long a = nio_get_Long(this, position(), limit()); inc_pos(8); return a; } final public ByteBuffer putLong(long value) { nio_put_Long(this, position(), limit(), value); inc_pos(8); return this; } final public long getLong(int index) { long a = nio_get_Long(this, index, limit()); return a; } final public ByteBuffer putLong(int index, long value) { nio_put_Long(this, index, limit(), value); return this; };
163      final public float getFloat() { float a = nio_get_Float(this, position(), limit()); inc_pos(4); return a; } final public ByteBuffer putFloat(float value) { nio_put_Float(this, position(), limit(), value); inc_pos(4); return this; } final public float getFloat(int index) { float a = nio_get_Float(this, index, limit()); return a; } final public ByteBuffer putFloat(int index, float value) { nio_put_Float(this, index, limit(), value); return this; };
164      final public double getDouble() { double a = nio_get_Double(this, position(), limit()); inc_pos(8); return a; } final public ByteBuffer putDouble(double value) { nio_put_Double(this, position(), limit(), value); inc_pos(8); return this; } final public double getDouble(int index) { double a = nio_get_Double(this, index, limit()); return a; } final public ByteBuffer putDouble(int index, double value) { nio_put_Double(this, index, limit(), value); return this; };
165  }  }

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

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