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

Diff of /classpath/java/nio/CharBufferImpl.java

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

revision 1.5.2.1 by gnu_andrew, Sun Jan 16 15:15:12 2005 UTC revision 1.5.2.2 by gnu_andrew, Thu Apr 28 23:00:13 2005 UTC
# Line 62  final class CharBufferImpl extends CharB Line 62  final class CharBufferImpl extends CharB
62    {    {
63      super (copy.capacity (), copy.limit (), copy.position (), 0);      super (copy.capacity (), copy.limit (), copy.position (), 0);
64      backing_buffer = copy.backing_buffer;      backing_buffer = copy.backing_buffer;
65        array_offset = copy.array_offset;
66      readOnly = copy.isReadOnly ();      readOnly = copy.isReadOnly ();
67    }    }
68        
# Line 127  final class CharBufferImpl extends CharB Line 128  final class CharBufferImpl extends CharB
128     */     */
129    public char get ()    public char get ()
130    {    {
131      checkForUnderflow();      if (pos >= limit)
132            throw new BufferUnderflowException();
133    
134      char result = backing_buffer [position ()];      return backing_buffer [(pos++) + array_offset];
     position (position () + 1);  
     return result;  
135    }    }
136        
137    /**    /**
# Line 142  final class CharBufferImpl extends CharB Line 142  final class CharBufferImpl extends CharB
142     */     */
143    public CharBuffer put (char value)    public CharBuffer put (char value)
144    {    {
145      checkIfReadOnly();      if (readOnly)
146                                throw new ReadOnlyBufferException();
147      backing_buffer [position ()] = value;      if (pos >= limit)
148      position (position () + 1);          throw new BufferOverflowException();
149    
150        backing_buffer [(pos++) + array_offset] = value;
151      return this;      return this;
152    }    }
153        
# Line 162  final class CharBufferImpl extends CharB Line 164  final class CharBufferImpl extends CharB
164    {    {
165      checkIndex(index);      checkIndex(index);
166            
167      return backing_buffer [index];      return backing_buffer [index + array_offset];
168    }    }
169        
170    /**    /**
171       * Bulk get, overloaded for speed.
172       */
173      public CharBuffer get (char[] dst, int offset, int length)
174      {
175        checkArraySize(dst.length, offset, length);
176        checkForUnderflow(length);
177    
178        System.arraycopy(backing_buffer, pos + array_offset,
179                         dst, offset, length);
180        pos += length;
181        return this;
182      }
183    
184      /**
185       * Bulk put, overloaded for speed.
186       */
187      public CharBuffer put (char[] src, int offset, int length)
188      {
189        checkArraySize(src.length, offset, length);
190        checkForOverflow(length);
191                        
192        System.arraycopy(src, offset,
193                         backing_buffer, pos + array_offset, length);
194        pos += length;
195        return this;
196      }
197    
198      /**
199     * Absolute put method. Writes <code>value</code> to position     * Absolute put method. Writes <code>value</code> to position
200     * <code>index</code> in the buffer.     * <code>index</code> in the buffer.
201     *     *
# Line 178  final class CharBufferImpl extends CharB Line 208  final class CharBufferImpl extends CharB
208      checkIndex(index);      checkIndex(index);
209      checkIfReadOnly();      checkIfReadOnly();
210                            
211      backing_buffer [index] = value;      backing_buffer [index + array_offset] = value;
212      return this;      return this;
213    }    }
214        

Legend:
Removed from v.1.5.2.1  
changed lines
  Added in v.1.5.2.2

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