12 package ncsa.hdf.hdflib;
31 private Object _theArray = null;
32 private ArrayDescriptor _desc = null;
33 private byte [] _barray = null;
37 if (anArray == null) {
42 Class tc = anArray.getClass();
43 if (tc.isArray() ==
false) {
51 _desc =
new ArrayDescriptor( _theArray );
71 if (_desc.dims == 1 && _desc.NT ==
'B') {
72 b = (byte [])_theArray;
74 b =
new byte[_desc.totalSize];
77 System.out.println(
"Error: HDFArray can't allocate bytes for array");
79 (HDFException)
new HDFJavaException(
"HDFArray: emptyBytes: allocation failed");
96 if (_barray != null)
return _barray;
97 if (_theArray == null) {
104 if (_desc.dims == 1) {
106 if (_desc.NT ==
'B') {
108 _barray = (byte [])_theArray;
112 _barray =
new byte[_desc.totalSize];
115 if (_desc.NT ==
'I') {
116 therow = ncsa.hdf.hdflib.HDFNativeData.intToByte(0,_desc.dimlen[1],(
int [])_theArray);
117 }
else if (_desc.NT ==
'S') {
118 therow = ncsa.hdf.hdflib.HDFNativeData.shortToByte(0,_desc.dimlen[1],(
short [])_theArray);
119 }
else if (_desc.NT ==
'F') {
120 therow = ncsa.hdf.hdflib.HDFNativeData.floatToByte(0,_desc.dimlen[1],(
float [])_theArray);
121 }
else if (_desc.NT ==
'J') {
122 therow = ncsa.hdf.hdflib.HDFNativeData.longToByte(0,_desc.dimlen[1],(
long [])_theArray);
123 }
else if (_desc.NT ==
'D') {
124 therow = ncsa.hdf.hdflib.HDFNativeData.doubleToByte(0,_desc.dimlen[1],(
double [])_theArray);
125 }
else if (_desc.NT ==
'L') {
126 if (_desc.className.equals(
"java.lang.Byte")) {
127 therow = ByteObjToByte((Byte[])_theArray);
128 }
else if (_desc.className.equals(
"java.lang.Integer")) {
129 therow = IntegerToByte((Integer[])_theArray);
130 }
else if (_desc.className.equals(
"java.lang.Short")) {
131 therow = ShortToByte((Short[])_theArray);
132 }
else if (_desc.className.equals(
"java.lang.Float")) {
133 therow = FloatObjToByte((Float[])_theArray);
134 }
else if (_desc.className.equals(
"java.lang.Double")) {
135 therow = DoubleObjToByte((Double[])_theArray);
136 }
else if (_desc.className.equals(
"java.lang.Long")) {
137 therow = LongObjToByte((Long[])_theArray);
148 System.arraycopy(therow,0,_barray,0,(_desc.dimlen[1] * _desc.NTsize));
150 }
catch (OutOfMemoryError err) {
153 ex.printStackTrace();
160 _barray =
new byte[_desc.totalSize];
161 }
catch (OutOfMemoryError err) {
164 ex.printStackTrace();
169 Object oo = _theArray;
173 while ( n < _desc.totalSize ) {
175 index = n / _desc.bytetoindex[0];
176 index %= _desc.dimlen[0];
177 for (i = 0 ; i < (_desc.dims); i++) {
178 index = n / _desc.bytetoindex[i];
179 index %= _desc.dimlen[i];
181 if (index == _desc.currentindex[i]) {
186 if (index > (_desc.dimlen[i] - 1)) {
187 System.out.println(
"out of bounds?");
190 oo = java.lang.reflect.Array.get((Object) oo,index);
191 _desc.currentindex[i] = index;
199 if (_desc.NT ==
'J') {
200 arow = ncsa.hdf.hdflib.HDFNativeData.longToByte(0,_desc.dimlen[_desc.dims],(
long [])_desc.objs[_desc.dims - 1]);
201 arow = ncsa.hdf.hdflib.HDFNativeData.longToByte(0,_desc.dimlen[_desc.dims],(
long [])_desc.objs[_desc.dims - 1]);
202 }
else if (_desc.NT ==
'I') {
203 arow = ncsa.hdf.hdflib.HDFNativeData.intToByte(0,_desc.dimlen[_desc.dims],(
int [])_desc.objs[_desc.dims - 1]);
204 }
else if (_desc.NT ==
'S') {
205 arow = ncsa.hdf.hdflib.HDFNativeData.shortToByte(0,_desc.dimlen[_desc.dims],(
short [])_desc.objs[_desc.dims - 1]);
206 }
else if (_desc.NT ==
'B') {
207 arow = (byte [])_desc.objs[_desc.dims - 1];
208 }
else if (_desc.NT ==
'F') {
210 arow = ncsa.hdf.hdflib.HDFNativeData.floatToByte(0,_desc.dimlen[_desc.dims],(
float [])_desc.objs[_desc.dims - 1]);
211 }
else if (_desc.NT ==
'D') {
213 arow = ncsa.hdf.hdflib.HDFNativeData.doubleToByte(0,_desc.dimlen[_desc.dims],(
double [])_desc.objs[_desc.dims - 1]);
214 }
else if (_desc.NT ==
'L') {
215 if (_desc.className.equals(
"java.lang.Byte")) {
216 arow = ByteObjToByte((Byte[])_desc.objs[_desc.dims - 1]);
217 }
else if (_desc.className.equals(
"java.lang.Integer")) {
218 arow = IntegerToByte((Integer[])_desc.objs[_desc.dims - 1]);
219 }
else if (_desc.className.equals(
"java.lang.Short")) {
220 arow = ShortToByte((Short[])_desc.objs[_desc.dims - 1]);
221 }
else if (_desc.className.equals(
"java.lang.Float")) {
222 arow = FloatObjToByte((Float[])_desc.objs[_desc.dims - 1]);
223 }
else if (_desc.className.equals(
"java.lang.Double")) {
224 arow = DoubleObjToByte((Double[])_desc.objs[_desc.dims - 1]);
225 }
else if (_desc.className.equals(
"java.lang.Long")) {
226 arow = LongObjToByte((Long[])_desc.objs[_desc.dims - 1]);
237 System.arraycopy(arow,0,_barray,n,(_desc.dimlen[_desc.dims] * _desc.NTsize));
238 n += _desc.bytetoindex[_desc.dims - 1];
239 }
catch (OutOfMemoryError err) {
242 ex.printStackTrace();
250 if (n < _desc.totalSize) {
251 throw new java.lang.InternalError(
252 new String(
"HDFArray:::byteify: Panic didn't complete all input data: n= "+n+
" size = "+_desc.totalSize));
254 for (i = 0;i < _desc.dims; i++) {
255 if (_desc.currentindex[i] != _desc.dimlen[i] - 1) {
256 throw new java.lang.InternalError(
257 new String(
"Panic didn't complete all data: currentindex["+i+
"] = "+_desc.currentindex[i]+
" (should be "+(_desc.dimlen[i] - 1)+
" ?)"));
273 if (_theArray == null) {
280 if (java.lang.reflect.Array.getLength((Object) bytes) != _desc.totalSize) {
286 if (_desc.dims == 1) {
290 if (_desc.NT ==
'I') {
291 int [] x = (
int [])ncsa.hdf.hdflib.HDFNativeData.byteToInt(_barray);
292 System.arraycopy(x,0,_theArray,0,_desc.dimlen[1]);
294 }
else if (_desc.NT ==
'S') {
295 short [] x = ncsa.hdf.hdflib.HDFNativeData.byteToShort(_barray);
296 System.arraycopy(x,0,_theArray,0,_desc.dimlen[1]);
298 }
else if (_desc.NT ==
'F') {
299 float x[] = ncsa.hdf.hdflib.HDFNativeData.byteToFloat(_barray);
300 System.arraycopy(x,0,_theArray,0,_desc.dimlen[1]);
302 }
else if (_desc.NT ==
'J') {
303 long x[] = ncsa.hdf.hdflib.HDFNativeData.byteToLong(_barray);
304 System.arraycopy(x,0,_theArray,0,_desc.dimlen[1]);
306 }
else if (_desc.NT ==
'D') {
307 double x[] = ncsa.hdf.hdflib.HDFNativeData.byteToDouble(_barray);
308 System.arraycopy(x,0,_theArray,0,_desc.dimlen[1]);
310 }
else if (_desc.NT ==
'B') {
311 System.arraycopy(_barray,0,_theArray,0,_desc.dimlen[1]);
313 }
else if (_desc.NT ==
'L') {
314 if (_desc.className.equals(
"java.lang.Byte")) {
315 Byte I[] = ByteToByteObj(_barray);
316 System.arraycopy(I,0,_theArray,0,_desc.dimlen[1]);
318 }
else if (_desc.className.equals(
"java.lang.Integer")) {
319 Integer I[] = ByteToInteger(_barray);
320 System.arraycopy(I,0,_theArray,0,_desc.dimlen[1]);
322 }
else if (_desc.className.equals(
"java.lang.Short")) {
323 Short I[] = ByteToShort(_barray);
324 System.arraycopy(I,0,_theArray,0,_desc.dimlen[1]);
326 }
else if (_desc.className.equals(
"java.lang.Float")) {
327 Float I[] = ByteToFloatObj(_barray);
328 System.arraycopy(I,0,_theArray,0,_desc.dimlen[1]);
330 }
else if (_desc.className.equals(
"java.lang.Double")) {
331 Double I[] = ByteToDoubleObj(_barray);
332 System.arraycopy(I,0,_theArray,0,_desc.dimlen[1]);
334 }
else if (_desc.className.equals(
"java.lang.Long")) {
335 Long I[] = ByteToLongObj(_barray);
336 System.arraycopy(I,0,_theArray,0,_desc.dimlen[1]);
348 }
catch (OutOfMemoryError err) {
351 ex.printStackTrace();
357 Object oo = _theArray;
361 while ( n < _desc.totalSize ) {
363 index = n / _desc.bytetoindex[0];
364 index %= _desc.dimlen[0];
365 for (i = 0 ; i < (_desc.dims); i++) {
366 index = n / _desc.bytetoindex[i];
367 index %= _desc.dimlen[i];
369 if (index == _desc.currentindex[i]) {
374 if (index > (_desc.dimlen[i] - 1)) {
375 System.out.println(
"out of bounds?");
378 oo = java.lang.reflect.Array.get((Object) oo,index);
379 _desc.currentindex[i] = index;
386 if (_desc.NT ==
'J') {
387 long [] arow = ncsa.hdf.hdflib.HDFNativeData.byteToLong(n,_desc.dimlen[_desc.dims],_barray);
388 java.lang.reflect.Array.set(_desc.objs[_desc.dims - 2] ,
389 (_desc.currentindex[_desc.dims - 1]), (Object)arow);
390 n += _desc.bytetoindex[_desc.dims - 1];
391 _desc.currentindex[_desc.dims - 1]++;
392 }
else if (_desc.NT ==
'I') {
393 int [] arow = ncsa.hdf.hdflib.HDFNativeData.byteToInt(n,_desc.dimlen[_desc.dims],_barray);
394 java.lang.reflect.Array.set(_desc.objs[_desc.dims - 2] ,
395 (_desc.currentindex[_desc.dims - 1]), (Object)arow);
397 n += _desc.bytetoindex[_desc.dims - 1];
398 _desc.currentindex[_desc.dims - 1]++;
399 }
else if (_desc.NT ==
'S') {
400 short [] arow = ncsa.hdf.hdflib.HDFNativeData.byteToShort(n,_desc.dimlen[_desc.dims],_barray);
401 java.lang.reflect.Array.set(_desc.objs[_desc.dims - 2] ,
402 (_desc.currentindex[_desc.dims - 1]), (Object)arow);
404 n += _desc.bytetoindex[_desc.dims - 1];
405 _desc.currentindex[_desc.dims - 1]++;
406 }
else if (_desc.NT ==
'B') {
407 System.arraycopy( _barray, n, _desc.objs[_desc.dims - 1], 0, _desc.dimlen[_desc.dims]);
408 n += _desc.bytetoindex[_desc.dims - 1];
409 }
else if (_desc.NT ==
'F') {
410 float arow[] = ncsa.hdf.hdflib.HDFNativeData.byteToFloat(n,_desc.dimlen[_desc.dims],_barray);
411 java.lang.reflect.Array.set(_desc.objs[_desc.dims - 2] ,
412 (_desc.currentindex[_desc.dims - 1]), (Object)arow);
414 n += _desc.bytetoindex[_desc.dims - 1];
415 _desc.currentindex[_desc.dims - 1]++;
416 }
else if (_desc.NT ==
'D') {
417 double [] arow = ncsa.hdf.hdflib.HDFNativeData.byteToDouble(n,_desc.dimlen[_desc.dims],_barray);
418 java.lang.reflect.Array.set(_desc.objs[_desc.dims - 2] ,
419 (_desc.currentindex[_desc.dims - 1]), (Object)arow);
421 n += _desc.bytetoindex[_desc.dims - 1];
422 _desc.currentindex[_desc.dims - 1]++;
423 }
else if (_desc.NT ==
'L') {
424 if (_desc.className.equals(
"java.lang.Byte")) {
425 Byte I[] = ByteToByteObj(n,_desc.dimlen[_desc.dims],_barray);
426 java.lang.reflect.Array.set(_desc.objs[_desc.dims - 2] ,
427 (_desc.currentindex[_desc.dims - 1]),
430 n += _desc.bytetoindex[_desc.dims - 1];
431 _desc.currentindex[_desc.dims - 1]++;
432 }
else if (_desc.className.equals(
"java.lang.Integer")) {
433 Integer I[] = ByteToInteger(n,_desc.dimlen[_desc.dims],_barray);
434 java.lang.reflect.Array.set(_desc.objs[_desc.dims - 2] ,
435 (_desc.currentindex[_desc.dims - 1]),
438 n += _desc.bytetoindex[_desc.dims - 1];
439 _desc.currentindex[_desc.dims - 1]++;
440 }
else if (_desc.className.equals(
"java.lang.Short")) {
441 Short I[] = ByteToShort(n,_desc.dimlen[_desc.dims],_barray);
442 java.lang.reflect.Array.set(_desc.objs[_desc.dims - 2] ,
443 (_desc.currentindex[_desc.dims - 1]),
446 n += _desc.bytetoindex[_desc.dims - 1];
447 _desc.currentindex[_desc.dims - 1]++;
448 }
else if (_desc.className.equals(
"java.lang.Float")) {
449 Float I[] = ByteToFloatObj(n,_desc.dimlen[_desc.dims],_barray);
450 java.lang.reflect.Array.set(_desc.objs[_desc.dims - 2] ,
451 (_desc.currentindex[_desc.dims - 1]),
454 n += _desc.bytetoindex[_desc.dims - 1];
455 _desc.currentindex[_desc.dims - 1]++;
456 }
else if (_desc.className.equals(
"java.lang.Double")) {
457 Double I[] = ByteToDoubleObj(n,_desc.dimlen[_desc.dims],_barray);
458 java.lang.reflect.Array.set(_desc.objs[_desc.dims - 2] ,
459 (_desc.currentindex[_desc.dims - 1]),
462 n += _desc.bytetoindex[_desc.dims - 1];
463 _desc.currentindex[_desc.dims - 1]++;
464 }
else if (_desc.className.equals(
"java.lang.Long")) {
465 Long I[] = ByteToLongObj(n,_desc.dimlen[_desc.dims],_barray);
466 java.lang.reflect.Array.set(_desc.objs[_desc.dims - 2] ,
467 (_desc.currentindex[_desc.dims - 1]),
470 n += _desc.bytetoindex[_desc.dims - 1];
471 _desc.currentindex[_desc.dims - 1]++;
482 }
catch (OutOfMemoryError err) {
485 ex.printStackTrace();
495 if (n < _desc.totalSize) {
496 throw new java.lang.InternalError(
497 new String(
"HDFArray::arrayify Panic didn't complete all input data: n= "+n+
" size = "+_desc.totalSize));
499 for (i = 0;i <= _desc.dims-2; i++) {
500 if (_desc.currentindex[i] != _desc.dimlen[i] - 1) {
501 throw new java.lang.InternalError(
502 new String(
"HDFArray::arrayify Panic didn't complete all data: currentindex["+i+
"] = "+_desc.currentindex[i]+
" (should be "+(_desc.dimlen[i] - 1)+
"?"));
505 if (_desc.NT !=
'B') {
506 if (_desc.currentindex[_desc.dims - 1] != _desc.dimlen[_desc.dims - 1]) {
507 throw new java.lang.InternalError(
508 new String(
"HDFArray::arrayify Panic didn't complete all data: currentindex["+i+
"] = "+_desc.currentindex[i]+
" (should be "+(_desc.dimlen[i])+
"?"));
511 if (_desc.currentindex[_desc.dims - 1] != (_desc.dimlen[_desc.dims - 1] - 1)) {
512 throw new java.lang.InternalError(
513 new String(
"HDFArray::arrayify Panic didn't complete all data: currentindex["+i+
"] = "+_desc.currentindex[i]+
" (should be "+(_desc.dimlen[i] - 1)+
"?"));
520 private byte[] IntegerToByte( Integer in[] ) {
521 int nelems = java.lang.reflect.Array.getLength((Object)in);
522 int[] out =
new int[nelems];
524 for (
int i = 0; i < nelems; i++) {
525 out[i] = in[i].intValue();
527 return HDFNativeData.intToByte(0,nelems,out);
530 private Integer[] ByteToInteger( byte[] bin ) {
531 int in[] = (
int [])HDFNativeData.byteToInt(bin);
532 int nelems = java.lang.reflect.Array.getLength((Object)in);
533 Integer[] out =
new Integer[nelems];
535 for (
int i = 0; i < nelems; i++) {
536 out[i] =
new Integer(in[i]);
540 private Integer[] ByteToInteger(
int start,
int len, byte[] bin ) {
541 int in[] = (
int [])HDFNativeData.byteToInt(start,len,bin);
542 int nelems = java.lang.reflect.Array.getLength((Object)in);
543 Integer[] out =
new Integer[nelems];
545 for (
int i = 0; i < nelems; i++) {
546 out[i] =
new Integer(in[i]);
552 private byte[] ShortToByte( Short in[] ) {
553 int nelems = java.lang.reflect.Array.getLength((Object)in);
554 short[] out =
new short[nelems];
556 for (
int i = 0; i < nelems; i++) {
557 out[i] = in[i].shortValue();
559 return HDFNativeData.shortToByte(0,nelems,out);
562 private Short[] ByteToShort( byte[] bin ) {
563 short in[] = (
short [])HDFNativeData.byteToShort(bin);
564 int nelems = java.lang.reflect.Array.getLength((Object)in);
565 Short[] out =
new Short[nelems];
567 for (
int i = 0; i < nelems; i++) {
568 out[i] =
new Short(in[i]);
573 private Short[] ByteToShort(
int start,
int len, byte[] bin ) {
574 short in[] = (
short [])HDFNativeData.byteToShort(start,len,bin);
575 int nelems = java.lang.reflect.Array.getLength((Object)in);
576 Short[] out =
new Short[nelems];
578 for (
int i = 0; i < nelems; i++) {
579 out[i] =
new Short(in[i]);
584 private byte[] ByteObjToByte( Byte in[] ) {
585 int nelems = java.lang.reflect.Array.getLength((Object)in);
586 byte[] out =
new byte[nelems];
588 for (
int i = 0; i < nelems; i++) {
589 out[i] = in[i].byteValue();
594 private Byte[] ByteToByteObj( byte[] bin ) {
595 int nelems = java.lang.reflect.Array.getLength((Object)bin);
596 Byte[] out =
new Byte[nelems];
598 for (
int i = 0; i < nelems; i++) {
599 out[i] =
new Byte(bin[i]);
604 private Byte[] ByteToByteObj(
int start,
int len, byte[] bin ) {
605 Byte[] out =
new Byte[len];
607 for (
int i = 0; i < len; i++) {
608 out[i] =
new Byte(bin[i]);
613 private byte[] FloatObjToByte( Float in[] ) {
614 int nelems = java.lang.reflect.Array.getLength((Object)in);
615 float[] out =
new float[nelems];
617 for (
int i = 0; i < nelems; i++) {
618 out[i] = in[i].floatValue();
620 return HDFNativeData.floatToByte(0,nelems,out);
623 private Float[] ByteToFloatObj( byte[] bin ) {
624 float in[] = (
float [])HDFNativeData.byteToFloat(bin);
625 int nelems = java.lang.reflect.Array.getLength((Object)in);
626 Float[] out =
new Float[nelems];
628 for (
int i = 0; i < nelems; i++) {
629 out[i] =
new Float(in[i]);
634 private Float[] ByteToFloatObj(
int start,
int len, byte[] bin ) {
635 float in[] = (
float [])HDFNativeData.byteToFloat(start,len,bin);
636 int nelems = java.lang.reflect.Array.getLength((Object)in);
637 Float[] out =
new Float[nelems];
639 for (
int i = 0; i < nelems; i++) {
640 out[i] =
new Float(in[i]);
645 private byte[] DoubleObjToByte( Double in[] ) {
646 int nelems = java.lang.reflect.Array.getLength((Object)in);
647 double[] out =
new double[nelems];
649 for (
int i = 0; i < nelems; i++) {
650 out[i] = in[i].doubleValue();
652 return HDFNativeData.doubleToByte(0,nelems,out);
655 private Double[] ByteToDoubleObj( byte[] bin ) {
656 double in[] = (
double [])HDFNativeData.byteToDouble(bin);
657 int nelems = java.lang.reflect.Array.getLength((Object)in);
658 Double[] out =
new Double[nelems];
660 for (
int i = 0; i < nelems; i++) {
661 out[i] =
new Double(in[i]);
666 private Double[] ByteToDoubleObj(
int start,
int len, byte[] bin ) {
667 double in[] = (
double [])HDFNativeData.byteToDouble(start,len,bin);
668 int nelems = java.lang.reflect.Array.getLength((Object)in);
669 Double[] out =
new Double[nelems];
671 for (
int i = 0; i < nelems; i++) {
672 out[i] =
new Double(in[i]);
677 private byte[] LongObjToByte( Long in[] ) {
678 int nelems = java.lang.reflect.Array.getLength((Object)in);
679 long[] out =
new long[nelems];
681 for (
int i = 0; i < nelems; i++) {
682 out[i] = in[i].longValue();
684 return HDFNativeData.longToByte(0,nelems,out);
687 private Long[] ByteToLongObj( byte[] bin ) {
688 long in[] = (
long [])HDFNativeData.byteToLong(bin);
689 int nelems = java.lang.reflect.Array.getLength((Object)in);
690 Long[] out =
new Long[nelems];
692 for (
int i = 0; i < nelems; i++) {
693 out[i] =
new Long(in[i]);
698 private Long[] ByteToLongObj(
int start,
int len, byte[] bin ) {
699 long in[] = (
long [])HDFNativeData.byteToLong(start,len,bin);
700 int nelems = java.lang.reflect.Array.getLength((Object)in);
701 Long[] out =
new Long[nelems];
703 for (
int i = 0; i < nelems; i++) {
704 out[i] =
new Long(in[i]);
717 class ArrayDescriptor {
719 static String theType =
"";
720 static Class theClass = null;
721 static int [] dimlen = null;
722 static int [] dimstart = null;
723 static int [] currentindex = null;
724 static int [] bytetoindex = null;
725 static int totalSize = 0;
726 static Object [] objs = null;
727 static char NT =
' ';
728 static int NTsize = 0;
730 static String className;
732 public ArrayDescriptor ( Object anArray )
throws HDFException {
734 Class tc = anArray.getClass();
735 if (tc.isArray() ==
false) {
738 (HDFException)
new HDFJavaException(
"ArrayDescriptor: not an array?: ");
746 String ss = tc.toString();
751 while (n < ss.length()) {
759 String css = ss.substring(ss.lastIndexOf(
'[')+1);
760 Class compC = tc.getComponentType();
761 String cs = compC.toString();
765 }
else if (NT ==
'S') {
767 }
else if ((NT ==
'I') || (NT ==
'F')) {
769 }
else if ((NT ==
'J') || (NT ==
'D')){
771 }
else if (css.startsWith(
"Ljava.lang.Byte")) {
773 className =
"java.lang.Byte";
775 }
else if (css.startsWith(
"Ljava.lang.Short")) {
777 className =
"java.lang.Short";
779 }
else if (css.startsWith(
"Ljava.lang.Integer")) {
781 className =
"java.lang.Integer";
783 }
else if (css.startsWith(
"Ljava.lang.Float")) {
785 className =
"java.lang.Float";
787 }
else if (css.startsWith(
"Ljava.lang.Double")) {
789 className =
"java.lang.Double";
791 }
else if (css.startsWith(
"Ljava.lang.Long")) {
793 className =
"java.lang.Long";
795 }
else if (css.startsWith(
"Ljava.lang.String")) {
796 throw new HDFJavaException(
new String(
"ArrayDesciptor: Error: String array not supported yet"));
799 throw new HDFJavaException(
new String(
"Error: array is not numeric? (type is "+css+
")"));
803 dimlen =
new int [dims+1];
804 dimstart =
new int [dims+1];
805 currentindex =
new int [dims+1];
806 bytetoindex =
new int [dims+1];
807 objs =
new Object [dims+1];
815 for ( i = 1; i <= dims; i++) {
816 dimlen[i]= java.lang.reflect.Array.getLength((Object) o);
817 o = java.lang.reflect.Array.get((Object) o,0);
825 bytetoindex[dims] = NTsize;
826 for ( i = dims; i >= 0; i--) {
828 for (j = i; j < dims; j++) {
834 totalSize = bytetoindex[0];
837 public void dumpInfo()
839 System.out.println(
"Type: "+theType);
840 System.out.println(
"Class: "+theClass);
841 System.out.println(
"NT: "+NT+
" NTsize: "+NTsize);
842 System.out.println(
"Array has "+dims+
" dimensions ("+totalSize+
" bytes)");
844 for (i = 0; i <= dims; i++) {
845 Class tc = objs[i].getClass();
846 String ss = tc.toString();
847 System.out.println(i+
": start "+dimstart[i]+
": len "+dimlen[i]+
" current "+currentindex[i]+
" bytetoindex "+bytetoindex[i]+
" object "+objs[i]+
" otype "+ss);