/[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.10 by mkoch, Mon Nov 25 07:50:52 2002 UTC revision 1.11 by mkoch, Tue Dec 3 13:23:51 2002 UTC
# Line 81  public final class ByteBufferImpl extend Line 81  public final class ByteBufferImpl extend
81      position (position () + toAdd);      position (position () + toAdd);
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    
92    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; }    ByteBufferImpl (byte[] copy)
93    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(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; }      this.backing_buffer = copy != null ? nio_cast (copy) : null;
95    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(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(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; }    private static native byte nio_get_Byte (ByteBufferImpl b, int index, int limit);
98    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      private static native void nio_put_Byte (ByteBufferImpl b, int index, int limit, byte value);
100      
101      public ByteBuffer asByteBuffer ()
102      {
103        ByteBufferImpl res = new ByteBufferImpl (backing_buffer);
104        res.limit ((limit () * 1) / 1);
105        return res;
106      }
107    
108      ByteBufferImpl (char[] copy)
109      {
110        this.backing_buffer = copy != null ? nio_cast (copy) : null;
111      }
112    
113      private static native char nio_get_Char (ByteBufferImpl b, int index, int limit);
114    
115      private static native void nio_put_Char (ByteBufferImpl b, int index, int limit, char value);
116    
117      public CharBuffer asCharBuffer ()
118      {
119        CharBufferImpl res = new CharBufferImpl (backing_buffer);
120        res.limit((limit()*2)/1);
121        return res;
122      }
123    
124      ByteBufferImpl (short[] copy)
125      {
126        this.backing_buffer = copy != null ? nio_cast (copy) : null;
127      }
128      
129      private static native short nio_get_Short (ByteBufferImpl b, int index, int limit);
130      
131      private static native void nio_put_Short (ByteBufferImpl b, int index, int limit, short value);
132      
133      public ShortBuffer asShortBuffer ()
134      {
135        ShortBufferImpl res = new ShortBufferImpl (backing_buffer);
136        res.limit ((limit () * 2) / 1);
137        return res;
138      }
139    
140      ByteBufferImpl (int[] copy)
141      {
142        this.backing_buffer = copy != null ? nio_cast(copy) : null;
143      }
144      
145      private static native int nio_get_Int (ByteBufferImpl b, int index, int limit);
146      
147      private static native void nio_put_Int (ByteBufferImpl b, int index, int limit, int value);
148      
149      public IntBuffer asIntBuffer ()
150      {
151        IntBufferImpl res = new IntBufferImpl (backing_buffer);
152        res.limit ((limit() * 4) / 1);
153        return res;
154      }
155    
156      ByteBufferImpl (long[] copy)
157      {
158        this.backing_buffer = copy != null ? nio_cast (copy) : null;
159      }
160      
161      private static native long nio_get_Long (ByteBufferImpl b, int index, int limit);
162      
163      private static native void nio_put_Long (ByteBufferImpl b, int index, int limit, long value);
164      
165      public LongBuffer asLongBuffer ()
166      {
167        LongBufferImpl res = new LongBufferImpl (backing_buffer);
168        res.limit ((limit() * 8) / 1);
169        return res;
170      }
171    
172      ByteBufferImpl (float[] copy)
173      {
174        this.backing_buffer = copy != null ? nio_cast (copy) : null;
175      }
176      
177      private static native float nio_get_Float (ByteBufferImpl b, int index, int limit);
178      
179      private static native void nio_put_Float (ByteBufferImpl b, int index, int limit, float value);
180      
181      public FloatBuffer asFloatBuffer ()
182      {
183        FloatBufferImpl res = new FloatBufferImpl (backing_buffer);
184        res.limit ((limit() * 4) / 1);
185        return res;
186      }
187    
188      ByteBufferImpl (double[] copy)
189      {
190        this.backing_buffer = copy != null ? nio_cast (copy) : null;
191      }
192      
193      private static native double nio_get_Double (ByteBufferImpl b, int index, int limit);
194      
195      private static native void nio_put_Double (ByteBufferImpl b, int index, int limit, double value);
196      
197      public DoubleBuffer asDoubleBuffer ()
198      {
199        DoubleBufferImpl res = new DoubleBufferImpl (backing_buffer);
200        res.limit ((limit () * 8) / 1);
201        return res;
202      }
203    
204    public boolean isReadOnly()    public boolean isReadOnly()
205    {    {

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

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