private static DBFColumnHeader readCol(InputStream is) throws IOException, TikaException { byte[] fieldRecord = new byte[32]; IOUtils.readFully(is, fieldRecord); DBFColumnHeader col = new DBFColumnHeader(); col.name = new byte[11]; System.arraycopy(fieldRecord, 0, col.name, 0, 10); int colType = fieldRecord[11] & 0xFF; if (colType < 0) { throw new IOException("File truncated before coltype in header"); } col.setType(colType); col.fieldLength = fieldRecord[16] & 0xFF; if (col.fieldLength < 0) { throw new TikaException("Field length for column "+col.getName(StandardCharsets.US_ASCII)+" is < 0"); } else if (col.fieldLength > DBFReader.MAX_FIELD_LENGTH) { throw new TikaException("Field length ("+col.fieldLength+") is greater than DBReader.MAX_FIELD_LENGTH ("+ DBFReader.MAX_FIELD_LENGTH+")"); } col.decimalCount = fieldRecord[17] & 0xFF; return col; }
private static DBFColumnHeader readCol(InputStream is) throws IOException, TikaException { byte[] fieldRecord = new byte[32]; IOUtils.readFully(is, fieldRecord); DBFColumnHeader col = new DBFColumnHeader(); col.name = new byte[11]; System.arraycopy(fieldRecord, 0, col.name, 0, 10); int colType = fieldRecord[11] & 0xFF; if (colType < 0) { throw new IOException("File truncated before coltype in header"); } col.setType(colType); col.fieldLength = fieldRecord[16] & 0xFF; if (col.fieldLength < 0) { throw new TikaException("Field length for column "+col.getName(StandardCharsets.US_ASCII)+" is < 0"); } else if (col.fieldLength > DBFReader.MAX_FIELD_LENGTH) { throw new TikaException("Field length ("+col.fieldLength+") is greater than DBReader.MAX_FIELD_LENGTH ("+ DBFReader.MAX_FIELD_LENGTH+")"); } col.decimalCount = fieldRecord[17] & 0xFF; return col; }
private static DBFColumnHeader readCol(InputStream is) throws IOException, TikaException { byte[] fieldRecord = new byte[32]; IOUtils.readFully(is, fieldRecord); DBFColumnHeader col = new DBFColumnHeader(); col.name = new byte[11]; System.arraycopy(fieldRecord, 0, col.name, 0, 10); int colType = fieldRecord[11] & 0xFF; if (colType < 0) { throw new IOException("File truncated before coltype in header"); } col.setType(colType); col.fieldLength = fieldRecord[16] & 0xFF; if (col.fieldLength < 0) { throw new TikaException("Field length for column "+col.getName(StandardCharsets.US_ASCII)+" is < 0"); } else if (col.fieldLength > DBFReader.MAX_FIELD_LENGTH) { throw new TikaException("Field length ("+col.fieldLength+") is greater than DBReader.MAX_FIELD_LENGTH ("+ DBFReader.MAX_FIELD_LENGTH+")"); } col.decimalCount = fieldRecord[17] & 0xFF; return col; }