jdk/test/java/nio/Buffer/Basic-X.java
changeset 2593 76032557be03
parent 1639 a97859015238
equal deleted inserted replaced
2590:52b974d64f18 2593:76032557be03
   363 
   363 
   364         // CharSequence ops
   364         // CharSequence ops
   365 
   365 
   366         b.position(2);
   366         b.position(2);
   367         ck(b, b.charAt(1), 'd');
   367         ck(b, b.charAt(1), 'd');
   368         CharBuffer c = (CharBuffer)b.subSequence(1, 4);
   368         CharBuffer c = b.subSequence(1, 4);
   369         ck(b, b.subSequence(1, 4).toString().equals("def"));
   369         ck(c, c.capacity(), b.capacity());
       
   370         ck(c, c.position(), b.position()+1);
       
   371         ck(c, c.limit(), b.position()+4);
       
   372         ck(c, b.subSequence(1, 4).toString().equals("def"));
   370 
   373 
   371         // 4938424
   374         // 4938424
   372         b.position(4);
   375         b.position(4);
   373         ck(b, b.charAt(1), 'f');
   376         ck(b, b.charAt(1), 'f');
   374         ck(b, b.subSequence(1, 3).toString().equals("fg"));
   377         ck(b, b.subSequence(1, 3).toString().equals("fg"));
   720                     b.put('x');
   723                     b.put('x');
   721                 }});
   724                 }});
   722         ck(b, start, b.position());
   725         ck(b, start, b.position());
   723         ck(b, end, b.limit());
   726         ck(b, end, b.limit());
   724         ck(b, s.length(), b.capacity());
   727         ck(b, s.length(), b.capacity());
       
   728         b.position(6);
       
   729         ck(b, b.subSequence(0,3).toString().equals("ghi"));
   725 
   730 
   726         // The index, relative to the position, must be non-negative and
   731         // The index, relative to the position, must be non-negative and
   727         // smaller than remaining().
   732         // smaller than remaining().
   728         tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
   733         tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
   729                 public void run() {
   734                 public void run() {