org.supercsv.cellprocessor.ParseLong Java Examples
The following examples show how to use
org.supercsv.cellprocessor.ParseLong.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MarketLogReader.java From jeveassets with GNU General Public License v2.0 | 6 votes |
private static CellProcessor[] getProcessors() { return new CellProcessor[]{ new ParseDouble(), // price new ParseDouble(), // volRemaining new ParseInt(), // typeID new ParseInt(), // range new ParseLong(), // orderID new ParseInt(), // volEntered new ParseInt(), // minVolume new ParseBool(), // bid new ParseDate(), // issueDate new ParseInt(), // duration new ParseLong(), // stationID new ParseLong(), // regionID new ParseLong(), // solarSystemID new ParseInt(), // jumps new Optional() }; }
Example #2
Source File: Utilities.java From pegasus with Apache License 2.0 | 6 votes |
/** * Read file sizes from CSV file. * * @param csvName CSV file name. * @throws IOException */ public static void loadHashMap(String csvName) throws IOException { final CellProcessor[] processors = new CellProcessor[] {null, null, null, null, new ParseLong()}; CsvBeanReader beanReader = new CsvBeanReader(new FileReader(csvName), CsvPreference.STANDARD_PREFERENCE); final String[] header = beanReader.getHeader(true); FileDataBean fileDataBean; sizes = new HashMap<String, Long>(); while ((fileDataBean = beanReader.read(FileDataBean.class, header, processors)) != null) { Long currentSize = sizes.get(fileDataBean.filename); if (currentSize != null) { assert (fileDataBean.length == currentSize); } sizes.put(fileDataBean.filename, fileDataBean.length); } }
Example #3
Source File: AbstractCsvParser.java From attic-apex-malhar with Apache License 2.0 | 5 votes |
public void initialise(String[] properties, CellProcessor[] processors) { for (int i = 0; i < getFields().size(); i++) { FIELD_TYPE type = getFields().get(i).type; properties[i] = getFields().get(i).name; if (type == FIELD_TYPE.DOUBLE) { processors[i] = new Optional(new ParseDouble()); } else if (type == FIELD_TYPE.INTEGER) { processors[i] = new Optional(new ParseInt()); } else if (type == FIELD_TYPE.FLOAT) { processors[i] = new Optional(new ParseDouble()); } else if (type == FIELD_TYPE.LONG) { processors[i] = new Optional(new ParseLong()); } else if (type == FIELD_TYPE.SHORT) { processors[i] = new Optional(new ParseInt()); } else if (type == FIELD_TYPE.STRING) { processors[i] = new Optional(); } else if (type == FIELD_TYPE.CHARACTER) { processors[i] = new Optional(new ParseChar()); } else if (type == FIELD_TYPE.BOOLEAN) { processors[i] = new Optional(new ParseChar()); } else if (type == FIELD_TYPE.DATE) { processors[i] = new Optional(new ParseDate("dd/MM/yyyy")); } } }
Example #4
Source File: CellProcessorBuilder.java From attic-apex-malhar with Apache License 2.0 | 5 votes |
/** * Get cellprocessor to parse String as Long. * * @param cellProcessor * next processor in the chain. * @return CellProcessor */ private static CellProcessor addParseLong(CellProcessor cellProcessor) { if (cellProcessor == null) { return new ParseLong(); } return new ParseLong((LongCellProcessor)cellProcessor); }