diff options
author | Allen Byrne <50328838+byrnHDF@users.noreply.github.com> | 2021-09-15 13:26:25 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-15 13:26:25 (GMT) |
commit | 1c892fb41fb5439d3b4a69fd3cd9d25e4aa2ee6e (patch) | |
tree | 13e69d68978d5d3e001e0438bd9b2d94838db944 /java/src/hdf/hdf5lib/HDFNativeData.java | |
parent | cd2ca91875be7d3ee98ab0131c32b9ee072509e5 (diff) | |
download | hdf5-1c892fb41fb5439d3b4a69fd3cd9d25e4aa2ee6e.zip hdf5-1c892fb41fb5439d3b4a69fd3cd9d25e4aa2ee6e.tar.gz hdf5-1c892fb41fb5439d3b4a69fd3cd9d25e4aa2ee6e.tar.bz2 |
Fix java warnings (#1005)
Diffstat (limited to 'java/src/hdf/hdf5lib/HDFNativeData.java')
-rw-r--r-- | java/src/hdf/hdf5lib/HDFNativeData.java | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/java/src/hdf/hdf5lib/HDFNativeData.java b/java/src/hdf/hdf5lib/HDFNativeData.java index 5b29050..85378db 100644 --- a/java/src/hdf/hdf5lib/HDFNativeData.java +++ b/java/src/hdf/hdf5lib/HDFNativeData.java @@ -153,8 +153,7 @@ public class HDFNativeData { * The input array of bytes * @return an array of 'len' float */ - public synchronized static native float[] byteToFloat(int start, int len, - byte[] data); + public synchronized static native float[] byteToFloat(int start, int len, byte[] data); /** * Convert 4 bytes from an array of bytes into a single float @@ -437,41 +436,38 @@ public class HDFNativeData { * - Error unsupported type. */ public synchronized static Object byteToNumber(byte[] barray, Object obj) - throws HDF5Exception { + throws HDF5Exception + { Class theClass = obj.getClass(); String type = theClass.getName(); Object retobj = null; if (type.equals("java.lang.Integer")) { int[] i = hdf.hdf5lib.HDFNativeData.byteToInt(0, 1, barray); - retobj = new Integer(i[0]); + retobj = Integer.valueOf(i[0]); } else if (type.equals("java.lang.Byte")) { - retobj = new Byte(barray[0]); + retobj = Byte.valueOf(barray[0]); } else if (type.equals("java.lang.Short")) { - short[] f = hdf.hdf5lib.HDFNativeData - .byteToShort(0, 1, barray); - retobj = new Short(f[0]); + short[] f = hdf.hdf5lib.HDFNativeData.byteToShort(0, 1, barray); + retobj = Short.valueOf(f[0]); } else if (type.equals("java.lang.Float")) { - float[] f = hdf.hdf5lib.HDFNativeData - .byteToFloat(0, 1, barray); - retobj = new Float(f[0]); + float[] f = hdf.hdf5lib.HDFNativeData.byteToFloat(0, 1, barray); + retobj = Float.valueOf(f[0]); } else if (type.equals("java.lang.Long")) { long[] f = hdf.hdf5lib.HDFNativeData.byteToLong(0, 1, barray); - retobj = new Long(f[0]); + retobj = Long.valueOf(f[0]); } else if (type.equals("java.lang.Double")) { - double[] f = hdf.hdf5lib.HDFNativeData.byteToDouble(0, 1, - barray); - retobj = new Double(f[0]); + double[] f = hdf.hdf5lib.HDFNativeData.byteToDouble(0, 1, barray); + retobj = Double.valueOf(f[0]); } else { /* exception: unsupported type */ - HDF5Exception ex = new HDF5JavaException( - "byteToNumber: setfield bad type: " + obj + " " + type); + HDF5Exception ex = new HDF5JavaException("byteToNumber: setfield bad type: " + obj + " " + type); throw (ex); } return (retobj); |