storm-apt/api/src/main/java/com/turbomanage/storm/csv/CsvUtils.java
public static String nextValue(StringReader in) throws IOException {
		StringWriter w = new StringWriter();
		boolean inQuotedValue = false;
		boolean openQuote = false;
		int c = in.read();
		if (c == QUOTE)
			inQuotedValue = true;
		else if (c == DELIMITER) {
			return null;
		} else if (c >= 0) {
			w.write(c);
		} else {
			throw new IOException("End of line reached");
		}
		c = in.read();
		while (c >= 0) {
			if (c == QUOTE) {
				if (inQuotedValue) {
					if (openQuote) {
						openQuote = false;
						w.write(QUOTE);
					} else {
						openQuote = true;
					}
				} else
					// invalid
					return w.toString();
			} else if (c == DELIMITER) {
				if (openQuote)
					return w.toString();
				else if (inQuotedValue)
					w.write(c);
				else
					// invalid
					return w.toString();
			} else
				w.write(c);
			c = in.read();
		}
		return w.toString();
	}
public static String nextValue(StringReader in) throws IOException {
		StringWriter w = new StringWriter();
		boolean inQuotedValue = false;
		boolean openQuote = false;
		int c = in.read();
		if (c == QUOTE)
			inQuotedValue = true;
		else if (c == DELIMITER) {
			return null;
		} else if (c >= 0) {
			w.write(c);
		} else {
			throw new IOException("End of line reached");
		}
		c = in.read();
		while (c >= 0) {
			if (c == QUOTE) {
				if (inQuotedValue) {
					if (openQuote) {
						openQuote = false;
						w.write(QUOTE);
					} else {
						openQuote = true;
					}
				} else
					// invalid
					return w.toString();
			} else if (c == DELIMITER) {
				if (openQuote)
					return w.toString();
				else if (inQuotedValue)
					w.write(c);
				else
					// invalid
					return w.toString();
			} else
				w.write(c);
			c = in.read();
		}
		return w.toString();
	}
public static String nextValue ( StringReader in ) throws IOException { StringWriter w = new StringWriter ( ) ; boolean inQuotedValue = false ; boolean openQuote = false ; int c = in . read ( ) ; if ( c == QUOTE ) inQuotedValue = true ; else if ( c == DELIMITER ) { return null ; } else if ( c >= 0 ) { w . write ( c ) ; } else { throw new IOException ( "End of line reached" ) ; } c = in . read ( ) ; while ( c >= 0 ) { if ( c == QUOTE ) { if ( inQuotedValue ) { if ( openQuote ) { openQuote = false ; w . write ( QUOTE ) ; } else { openQuote = true ; } } else // invalid return w . toString ( ) ; } else if ( c == DELIMITER ) { if ( openQuote ) return w . toString ( ) ; else if ( inQuotedValue ) w . write ( c ) ; else // invalid return w . toString ( ) ; } else w . write ( c ) ; c = in . read ( ) ; } return w . toString ( ) ; }
Obtains the next value from a {@link StringReader}.

@param in
@return An escaped value
@throws IOException
Obtains the next value from a { @link StringReader } .