@Test void testUnsupportedFloatingPointLengthThrows() { FloatingPoint invalidDataType = mockFloatingPoint(11); HdfFileChannel hdfFc = mock(HdfFileChannel.class); assertThrows(HdfTypeException.class, () -> invalidDataType.fillData(floatBuffer, dims, hdfFc)); verifyNoInteractions(hdfFc); }
@Override public Object fillData(ByteBuffer buffer, int[] dimensions, HdfFileChannel hdfFc) { final Object data = Array.newInstance(getJavaType(), dimensions); final ByteOrder byteOrder = getByteOrder(); switch (getSize()) { case 2: fillData(data, dimensions, buffer.order(byteOrder).asShortBuffer()); break; case 4: fillData(data, dimensions, buffer.order(byteOrder).asFloatBuffer()); break; case 8: fillData(data, dimensions, buffer.order(byteOrder).asDoubleBuffer()); break; default: throw new HdfTypeException( "Unsupported floating point type size " + getSize() + " bytes"); } return data; }
FloatingPoint extends DataType implements OrderedDataType { @Override public Object fillData(ByteBuffer buffer, int[] dimensions, HdfFileChannel hdfFc) { final Object data = Array.newInstance(getJavaType(), dimensions); final ByteOrder byteOrder = getByteOrder(); switch (getSize()) { case 2: fillData(data, dimensions, buffer.order(byteOrder).asShortBuffer()); break; case 4: fillData(data, dimensions, buffer.order(byteOrder).asFloatBuffer()); break; case 8: fillData(data, dimensions, buffer.order(byteOrder).asDoubleBuffer()); break; default: throw new HdfTypeException( "Unsupported floating point type size " + getSize() + " bytes"); } return data; } }
FloatingPoint extends DataType implements OrderedDataType { @Override public Object fillData(ByteBuffer buffer, int[] dimensions, HdfFileChannel hdfFc) { final Object data = Array.newInstance(getJavaType(), dimensions); final ByteOrder byteOrder = getByteOrder(); switch (getSize()) { case 2: fillData(data, dimensions, buffer.order(byteOrder).asShortBuffer()); break; case 4: fillData(data, dimensions, buffer.order(byteOrder).asFloatBuffer()); break; case 8: fillData(data, dimensions, buffer.order(byteOrder).asDoubleBuffer()); break; default: throw new HdfTypeException( "Unsupported floating point type size " + getSize() + " bytes"); } return data; } FloatingPoint(ByteBuffer bb); }
FloatingPoint extends DataType implements OrderedDataType { @Override public Object fillData(ByteBuffer buffer, int[] dimensions, HdfFileChannel hdfFc) { final Object data = Array.newInstance(getJavaType(), dimensions); final ByteOrder byteOrder = getByteOrder(); switch (getSize()) { case 2: fillData(data, dimensions, buffer.order(byteOrder).asShortBuffer()); break; case 4: fillData(data, dimensions, buffer.order(byteOrder).asFloatBuffer()); break; case 8: fillData(data, dimensions, buffer.order(byteOrder).asDoubleBuffer()); break; default: throw new HdfTypeException( "Unsupported floating point type size " + getSize() + " bytes"); } return data; } FloatingPoint(ByteBuffer bb); @Override ByteOrder getByteOrder(); boolean isLowPadding(); boolean isHighPadding(); boolean isInternalPadding(); int getMantissaNormalization(); int getSignLocation(); short getBitOffset(); short getBitPrecision(); byte getExponentLocation(); byte getExponentSize(); byte getMantissaLocation(); byte getMantissaSize(); int getExponentBias(); @Override Class<?> getJavaType(); @Override Object fillData(ByteBuffer buffer, int[] dimensions, HdfFileChannel hdfFc); static float toFloat(short element); }
FloatingPoint extends DataType implements OrderedDataType { @Override public Object fillData(ByteBuffer buffer, int[] dimensions, HdfFileChannel hdfFc) { final Object data = Array.newInstance(getJavaType(), dimensions); final ByteOrder byteOrder = getByteOrder(); switch (getSize()) { case 2: fillData(data, dimensions, buffer.order(byteOrder).asShortBuffer()); break; case 4: fillData(data, dimensions, buffer.order(byteOrder).asFloatBuffer()); break; case 8: fillData(data, dimensions, buffer.order(byteOrder).asDoubleBuffer()); break; default: throw new HdfTypeException( "Unsupported floating point type size " + getSize() + " bytes"); } return data; } FloatingPoint(ByteBuffer bb); @Override ByteOrder getByteOrder(); boolean isLowPadding(); boolean isHighPadding(); boolean isInternalPadding(); int getMantissaNormalization(); int getSignLocation(); short getBitOffset(); short getBitPrecision(); byte getExponentLocation(); byte getExponentSize(); byte getMantissaLocation(); byte getMantissaSize(); int getExponentBias(); @Override Class<?> getJavaType(); @Override Object fillData(ByteBuffer buffer, int[] dimensions, HdfFileChannel hdfFc); static float toFloat(short element);  }