1 7 8 package java.lang.reflect; 9 10 20 public final 21 class Array { 22 23 26 private Array() {} 27 28 50 public static Object newInstance(Class <?> componentType, int length) 51 throws NegativeArraySizeException { 52 return newArray(componentType, length); 53 } 54 55 88 public static Object newInstance(Class <?> componentType, int[] dimensions) 89 throws IllegalArgumentException , NegativeArraySizeException { 90 return multiNewArray(componentType, dimensions); 91 } 92 93 101 public static native int getLength(Object array) 102 throws IllegalArgumentException ; 103 104 120 public static native Object get(Object array, int index) 121 throws IllegalArgumentException , ArrayIndexOutOfBoundsException ; 122 123 139 public static native boolean getBoolean(Object array, int index) 140 throws IllegalArgumentException , ArrayIndexOutOfBoundsException ; 141 142 158 public static native byte getByte(Object array, int index) 159 throws IllegalArgumentException , ArrayIndexOutOfBoundsException ; 160 161 177 public static native char getChar(Object array, int index) 178 throws IllegalArgumentException , ArrayIndexOutOfBoundsException ; 179 180 196 public static native short getShort(Object array, int index) 197 throws IllegalArgumentException , ArrayIndexOutOfBoundsException ; 198 199 215 public static native int getInt(Object array, int index) 216 throws IllegalArgumentException , ArrayIndexOutOfBoundsException ; 217 218 234 public static native long getLong(Object array, int index) 235 throws IllegalArgumentException , ArrayIndexOutOfBoundsException ; 236 237 253 public static native float getFloat(Object array, int index) 254 throws IllegalArgumentException , ArrayIndexOutOfBoundsException ; 255 256 272 public static native double getDouble(Object array, int index) 273 throws IllegalArgumentException , ArrayIndexOutOfBoundsException ; 274 275 292 public static native void set(Object array, int index, Object value) 293 throws IllegalArgumentException , ArrayIndexOutOfBoundsException ; 294 295 312 public static native void setBoolean(Object array, int index, boolean z) 313 throws IllegalArgumentException , ArrayIndexOutOfBoundsException ; 314 315 332 public static native void setByte(Object array, int index, byte b) 333 throws IllegalArgumentException , ArrayIndexOutOfBoundsException ; 334 335 352 public static native void setChar(Object array, int index, char c) 353 throws IllegalArgumentException , ArrayIndexOutOfBoundsException ; 354 355 372 public static native void setShort(Object array, int index, short s) 373 throws IllegalArgumentException , ArrayIndexOutOfBoundsException ; 374 375 392 public static native void setInt(Object array, int index, int i) 393 throws IllegalArgumentException , ArrayIndexOutOfBoundsException ; 394 395 412 public static native void setLong(Object array, int index, long l) 413 throws IllegalArgumentException , ArrayIndexOutOfBoundsException ; 414 415 432 public static native void setFloat(Object array, int index, float f) 433 throws IllegalArgumentException , ArrayIndexOutOfBoundsException ; 434 435 452 public static native void setDouble(Object array, int index, double d) 453 throws IllegalArgumentException , ArrayIndexOutOfBoundsException ; 454 455 458 459 private static native Object newArray(Class componentType, int length) 460 throws NegativeArraySizeException ; 461 462 private static native Object multiNewArray(Class componentType, 463 int[] dimensions) 464 throws IllegalArgumentException , NegativeArraySizeException ; 465 466 467 } 468 | Popular Tags |