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

Diff of /classpath/java/nio/ByteBufferImpl.java

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

revision 1.11 by jfrijters, Mon Apr 18 09:03:04 2005 UTC revision 1.12 by smarothy, Mon Apr 18 15:57:39 2005 UTC
# Line 149  final class ByteBufferImpl extends ByteB Line 149  final class ByteBufferImpl extends ByteB
149    
150      return backing_buffer [(pos++) + array_offset];      return backing_buffer [(pos++) + array_offset];
151    }    }
152      
153      /**
154       * Bulk get
155       */
156      public ByteBuffer get (byte[] dst, int offset, int length)
157      {
158        checkArraySize(dst.length, offset, length);
159        if ( (limit - pos) < length) // check for overflow
160          throw new BufferUnderflowException();
161    
162        System.arraycopy(backing_buffer, pos + array_offset,
163                         dst, offset, length);
164        pos += length;
165    
166        return this;
167      }
168    
169      /**
170       * Relative bulk put(), overloads the ByteBuffer impl.
171       */
172      public ByteBuffer put (byte[] src, int offset, int length)
173      {
174        if ( (limit - pos) < length) // check for overflow
175          throw new BufferOverflowException();
176        checkArraySize(src.length, offset, length);
177    
178        System.arraycopy(src, offset, backing_buffer, pos + array_offset, length);
179        pos += length;
180    
181        return this;
182      }
183    
184    /**    /**
185     * Relative put method. Writes <code>value</code> to the next position     * Relative put method. Writes <code>value</code> to the next position
186     * in the buffer.     * in the buffer.
# Line 207  final class ByteBufferImpl extends ByteB Line 238  final class ByteBufferImpl extends ByteB
238        
239    public ByteBuffer putChar (char value)    public ByteBuffer putChar (char value)
240    {    {
241      ByteBufferHelper.putChar(this, value, order());      if (readOnly)
242          throw new ReadOnlyBufferException ();
243        if ( (limit-pos) < 2)
244          throw new BufferOverflowException();
245    
246        if (endian == ByteOrder.LITTLE_ENDIAN)
247          {
248            backing_buffer [(pos++) + array_offset] = (byte)(value&0xFF);
249            backing_buffer [(pos++) + array_offset] = (byte)(value>>8);
250          }
251        else
252          {
253            backing_buffer [(pos++) + array_offset] = (byte)(value>>8);
254            backing_buffer [(pos++) + array_offset] = (byte)(value&0xFF);
255          }
256      return this;      return this;
257    }    }
258        

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

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