src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template
changeset 53901 0448cb38c418
parent 53855 7c362992527a
child 53959 1542e63eb537
equal deleted inserted replaced
53900:4008a1d5cfbc 53901:0448cb38c418
   268 #else[rw]
   268 #else[rw]
   269         throw new ReadOnlyBufferException();
   269         throw new ReadOnlyBufferException();
   270 #end[rw]
   270 #end[rw]
   271     }
   271     }
   272 
   272 
       
   273 #if[char]
       
   274 
       
   275     public $Type$Buffer put(String src, int start, int end) {
       
   276         int length = end - start;
       
   277         checkBounds(start, length, src.length());
       
   278         if (isReadOnly())
       
   279             throw new ReadOnlyBufferException();
       
   280         int pos = position();
       
   281         int lim = limit();
       
   282         int rem = (pos <= lim) ? lim - pos : 0;
       
   283         if (length > rem)
       
   284             throw new BufferOverflowException();
       
   285         src.getChars(start, end, hb, ix(pos));
       
   286         position(pos + length);
       
   287         return this;
       
   288     }
       
   289 
       
   290 #end[char]
       
   291 
   273     public $Type$Buffer compact() {
   292     public $Type$Buffer compact() {
   274 #if[rw]
   293 #if[rw]
   275         System.arraycopy(hb, ix(position()), hb, ix(0), remaining());
   294         System.arraycopy(hb, ix(position()), hb, ix(0), remaining());
   276         position(remaining());
   295         position(remaining());
   277         limit(capacity());
   296         limit(capacity());