jdk/test/java/nio/Buffer/BasicFloat.java
changeset 1634 3871c2046043
parent 2 90ce3da70b43
child 1639 a97859015238
equal deleted inserted replaced
1633:02413b195191 1634:3871c2046043
    29  */
    29  */
    30 
    30 
    31 // -- This file was mechanically generated: Do not edit! -- //
    31 // -- This file was mechanically generated: Do not edit! -- //
    32 
    32 
    33 import java.nio.*;
    33 import java.nio.*;
       
    34 import java.lang.reflect.Method;
    34 
    35 
    35 
    36 
    36 public class BasicFloat
    37 public class BasicFloat
    37     extends Basic
    38     extends Basic
    38 {
    39 {
   281 
   282 
   282 
   283 
   283 
   284 
   284 
   285 
   285 
   286 
       
   287 
       
   288 
       
   289 
       
   290 
       
   291 
       
   292 
       
   293 
       
   294 
       
   295 
       
   296 
       
   297 
       
   298 
       
   299 
       
   300 
       
   301 
       
   302 
       
   303 
       
   304 
       
   305 
       
   306 
       
   307 
       
   308 
       
   309 
       
   310 
       
   311 
   286     private static void tryCatch(Buffer b, Class ex, Runnable thunk) {
   312     private static void tryCatch(Buffer b, Class ex, Runnable thunk) {
   287         boolean caught = false;
   313         boolean caught = false;
   288         try {
   314         try {
   289             thunk.run();
   315             thunk.run();
   290         } catch (Throwable x) {
   316         } catch (Throwable x) {
   291             if (ex.isAssignableFrom(x.getClass()))
   317             if (ex.isAssignableFrom(x.getClass())) {
   292                 caught = true;
   318                 caught = true;
       
   319             } else {
       
   320                 fail(x.getMessage() + " not expected");
       
   321             }
   293         }
   322         }
   294         if (!caught)
   323         if (!caught)
   295             fail(ex.getName() + " not thrown", b);
   324             fail(ex.getName() + " not thrown", b);
   296     }
   325     }
   297 
   326 
   354         b.flip();
   383         b.flip();
   355         relGet(b, 13);
   384         relGet(b, 13);
   356 
   385 
   357         // Exceptions
   386         // Exceptions
   358 
   387 
   359         boolean caught = false;
       
   360         relPut(b);
   388         relPut(b);
   361         b.limit(b.capacity() / 2);
   389         b.limit(b.capacity() / 2);
   362         b.position(b.limit());
   390         b.position(b.limit());
   363 
   391 
   364         tryCatch(b, BufferUnderflowException.class, new Runnable() {
   392         tryCatch(b, BufferUnderflowException.class, new Runnable() {
   382                 }});
   410                 }});
   383 
   411 
   384         tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
   412         tryCatch(b, IndexOutOfBoundsException.class, new Runnable() {
   385                 public void run() {
   413                 public void run() {
   386                     b.put(b.limit(), (float)42);
   414                     b.put(b.limit(), (float)42);
       
   415                 }});
       
   416 
       
   417         tryCatch(b, InvalidMarkException.class, new Runnable() {
       
   418                 public void run() {
       
   419                     b.position(0);
       
   420                     b.mark();
       
   421                     b.compact();
       
   422                     b.reset();
   387                 }});
   423                 }});
   388 
   424 
   389         // Values
   425         // Values
   390 
   426 
   391         b.clear();
   427         b.clear();