/[classpath]/classpath/java/nio/FloatBuffer.java
ViewVC logotype

Diff of /classpath/java/nio/FloatBuffer.java

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

revision 1.10 by mkoch, Sun May 18 12:12:40 2003 UTC revision 1.11 by mkoch, Mon May 19 08:36:27 2003 UTC
# Line 51  public abstract class FloatBuffer extend Line 51  public abstract class FloatBuffer extend
51    protected FloatBuffer (int capacity, int limit, int position, int mark)    protected FloatBuffer (int capacity, int limit, int position, int mark)
52    {    {
53      super (capacity, limit, position, mark);      super (capacity, limit, position, mark);
54        array_offset = 0;
55    }    }
56      
57    public static FloatBuffer allocate(int capacity)    protected FloatBuffer (float[] buffer, int offset, int capacity, int limit, int position, int mark)
58      {
59        super (capacity, limit, position, mark);
60        this.backing_buffer = buffer;
61        this.array_offset = offset;
62      }
63    
64      /**
65       * Allocates a new <code>FloatBuffer</code> object with a given capacity.
66       */
67      public static FloatBuffer allocate (int capacity)
68    {    {
69      return new FloatBufferImpl (capacity, 0, capacity);      return new FloatBufferImpl (capacity);
70    }    }
71    
72    final public static FloatBuffer wrap(float[] array, int offset, int length)    /**
73       * Wraps a <code>float</code> array into a <code>FloatBuffer</code>
74       * object.
75       *
76       * @exception IndexOutOfBoundsException If the preconditions on the offset
77       * and length parameters do not hold
78       */
79      final public static FloatBuffer wrap (float[] array, int offset, int length)
80    {    {
81      return new FloatBufferImpl(array, offset, length);      return new FloatBufferImpl (array, 0, array.length, offset + length, offset, -1, false);
82    }    }
83    
84    /**    /**
# Line 71  public abstract class FloatBuffer extend Line 89  public abstract class FloatBuffer extend
89    {    {
90      return wrap (array, 0, array.length);      return wrap (array, 0, array.length);
91    }    }
92      
93    /**    /**
94     * This method transfers <code>floats<code> from this buffer into the given     * This method transfers <code>floats<code> from this buffer into the given
95     * destination array.     * destination array.
# Line 124  public abstract class FloatBuffer extend Line 142  public abstract class FloatBuffer extend
142     */     */
143    public FloatBuffer put (FloatBuffer src)    public FloatBuffer put (FloatBuffer src)
144    {    {
145      while (src.hasRemaining())      if (src == this)
146        put(src.get());        throw new IllegalArgumentException ();
147    
148        if (src.remaining () > remaining ())
149          throw new BufferOverflowException ();
150    
151        if (src.remaining () > 0)
152          {
153            float[] toPut = new float [src.remaining ()];
154            src.get (toPut);
155            src.put (toPut);
156          }
157    
158      return this;      return this;
159    }    }

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