M
MileHighCelt
I have been looking thru use groups and API's and there seems to be
some issue on parsing a tab delimited file. If a user uploads a file
that is tab delimited, and could contain nulls, is this necessarily the
best approach:
InputStream in = theFile.getInputStream();
BufferedReader r = new BufferedReader(new InputStreamReader(in));
String line;
while ((line = r.readLine()) != null) {
StringTokenizer st = new StringTokenizer(line, "\t", true);
MyBean region = new MyBean();
region.setLab_id(Integer.parseInt(st.nextToken()));
region.setControl_nmbr(st.nextToken());
...
}
As I understand it, the "true" arguement in the tokenizer will handle
the nulls/no value as empty strings?
Is there a better way to solve this? Therre are probably 50 columns
per row, with a variety of date, int, and String values.
Thank you for you opinion and advice.
some issue on parsing a tab delimited file. If a user uploads a file
that is tab delimited, and could contain nulls, is this necessarily the
best approach:
InputStream in = theFile.getInputStream();
BufferedReader r = new BufferedReader(new InputStreamReader(in));
String line;
while ((line = r.readLine()) != null) {
StringTokenizer st = new StringTokenizer(line, "\t", true);
MyBean region = new MyBean();
region.setLab_id(Integer.parseInt(st.nextToken()));
region.setControl_nmbr(st.nextToken());
...
}
As I understand it, the "true" arguement in the tokenizer will handle
the nulls/no value as empty strings?
Is there a better way to solve this? Therre are probably 50 columns
per row, with a variety of date, int, and String values.
Thank you for you opinion and advice.