public static Number readNumericStoredAsText(DataInputStream dataInput, int length) throws IOException {
		try {
			byte t_float[] = new byte[length];
			int readed = dataInput.read(t_float);
			if (readed != length) {
				throw new EOFException("failed to read:" + length + " bytes");
			}
			t_float = DBFUtils.removeSpaces(t_float);
			t_float = DBFUtils.removeNullBytes(t_float);
			if (t_float.length > 0 && DBFUtils.isPureAscii(t_float) && !DBFUtils.contains(t_float, (byte) '?') && !DBFUtils.contains(t_float, (byte) '*')) {
				String aux = new String(t_float, StandardCharsets.US_ASCII).replace(',', '.');
				if (".".equals(aux)) {
					return BigDecimal.ZERO;
				}
				return new BigDecimal(aux);
			} else {
				return null;
			}
		} catch (NumberFormatException e) {
			throw new DBFException("Failed to parse Float: " + e.getMessage(), e);
		}
	}
public static Number readNumericStoredAsText ( DataInputStream dataInput , int length ) throws IOException { try { byte t_float [ ] = new byte [ length ] ; int readed = dataInput . read ( t_float ) ; if ( readed != length ) { throw new EOFException ( "failed to read:" + length + " bytes" ) ; } t_float = DBFUtils . removeSpaces ( t_float ) ; t_float = DBFUtils . removeNullBytes ( t_float ) ; if ( t_float . length > 0 && DBFUtils . isPureAscii ( t_float ) && ! DBFUtils . contains ( t_float , ( byte ) '?' ) && ! DBFUtils . contains ( t_float , ( byte ) '*' ) ) { String aux = new String ( t_float , StandardCharsets . US_ASCII ) . replace ( ',' , '.' ) ; if ( "." . equals ( aux ) ) { return BigDecimal . ZERO ; } return new BigDecimal ( aux ) ; } else { return null ; } } catch ( NumberFormatException e ) { throw new DBFException ( "Failed to parse Float: " + e . getMessage ( ) , e ) ; } }
Reads a number from a stream,
@param dataInput the stream data
@param length the legth of the number
@return The number as a Number (BigDecimal)
@throws IOException if an IO error happens
@throws EOFException if reached end of file before length bytes