From: <be...@us...> - 2006-10-26 15:53:11
|
Revision: 128 http://svn.sourceforge.net/pzfilereader/?rev=128&view=rev Author: benoitx Date: 2006-10-26 08:53:08 -0700 (Thu, 26 Oct 2006) Log Message: ----------- Try to reduce the number of trimmings but Paul, could you check the comments //+ as I believe that those tests are redudant... Modified Paths: -------------- trunk/PZFileReader/src/main/java/net/sf/pzfilereader/DataSet.java Modified: trunk/PZFileReader/src/main/java/net/sf/pzfilereader/DataSet.java =================================================================== --- trunk/PZFileReader/src/main/java/net/sf/pzfilereader/DataSet.java 2006-10-26 15:51:35 UTC (rev 127) +++ trunk/PZFileReader/src/main/java/net/sf/pzfilereader/DataSet.java 2006-10-26 15:53:08 UTC (rev 128) @@ -740,7 +740,8 @@ while ((line = br.readLine()) != null) { lineCount++; /** empty line skip past it */ - if (!processingMultiLine && line.trim().length() == 0) { + String trimmed = line.trim(); + if (!processingMultiLine && trimmed.length() == 0) { continue; } @@ -759,7 +760,7 @@ // any line breaks in the middle of the record, this will only // be checked if we have specified a delimiter // ******************************************************** - final char[] chrArry = line.trim().toCharArray(); + final char[] chrArry = trimmed.toCharArray(); if (!processingMultiLine && delimiter > 0) { processingMultiLine = ParserUtils.isMultiLine(chrArry, delimiter, qualifier); } @@ -767,26 +768,25 @@ // check to see if we have reached the end of the linebreak in // the record - if (processingMultiLine && lineData.trim().length() > 0) { + final String trimmedLineData = lineData.trim(); + if (processingMultiLine && trimmedLineData.length() > 0) { // need to do one last check here. it is possible that the " // could be part of the data // excel will escape these with another quote; here is some // data "" This would indicate // there is more to the multiline - String trimmed = line.trim(); if (trimmed.charAt(trimmed.length() - 1) == qualifier && !trimmed.endsWith("" + qualifier + qualifier)) { // it is safe to assume we have reached the end of the // line break processingMultiLine = false; - if (lineData.trim().length() > 0) { + if (trimmedLineData.length() > 0) { //+ would always be true surely.... lineData += "\r\n"; } lineData += line; } else { - // check to see if this is the last line of the record // looking for a qualifier followed by a delimiter - if (lineData.trim().length() > 0) { + if (trimmedLineData.length() > 0) { //+ here again, this should always be true... lineData += "\r\n"; } lineData += line; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |