Package com.ongres.scram.common.util
Class StringWritableCsv
- java.lang.Object
-
- com.ongres.scram.common.util.StringWritableCsv
-
public class StringWritableCsv extends java.lang.Object
Helper class to generate Comma Separated Values ofStringWritable
s
-
-
Constructor Summary
Constructors Constructor Description StringWritableCsv()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String[]
parseFrom(java.lang.String value)
Parse a String with aStringWritableCsv
into its composing Strings represented as Strings.static java.lang.String[]
parseFrom(java.lang.String value, int n)
Parse a String with aStringWritableCsv
into its composing Strings represented as Strings.static java.lang.String[]
parseFrom(java.lang.String value, int n, int offset)
Parse a String with aStringWritableCsv
into its composing Strings represented as Strings.private static void
writeStringWritableToStringBuffer(StringWritable value, java.lang.StringBuffer sb)
static java.lang.StringBuffer
writeTo(java.lang.StringBuffer sb, StringWritable... values)
Write a sequence ofStringWritableCsv
s to a StringBuffer.
-
-
-
Method Detail
-
writeStringWritableToStringBuffer
private static void writeStringWritableToStringBuffer(StringWritable value, java.lang.StringBuffer sb)
-
writeTo
public static java.lang.StringBuffer writeTo(java.lang.StringBuffer sb, StringWritable... values) throws java.lang.IllegalArgumentException
Write a sequence ofStringWritableCsv
s to a StringBuffer. NullStringWritable
s are not printed, but separator is still used. Separator is a comma (',')- Parameters:
sb
- The sb to write tovalues
- Zero or more attribute-value pairs to write- Returns:
- The same sb, with data filled in (if any)
- Throws:
java.lang.IllegalArgumentException
- If sb is null
-
parseFrom
public static java.lang.String[] parseFrom(java.lang.String value, int n, int offset) throws java.lang.IllegalArgumentException
Parse a String with aStringWritableCsv
into its composing Strings represented as Strings. No validation is performed on the individual attribute-values returned.- Parameters:
value
- The String with the set of attribute-valuesn
- Number of entries to return (entries will be null of there were not enough). 0 means unlimitedoffset
- How many entries to skip before start returning- Returns:
- An array of Strings which represent the individual attribute-values
- Throws:
java.lang.IllegalArgumentException
- If value is null or either n or offset are negative
-
parseFrom
public static java.lang.String[] parseFrom(java.lang.String value, int n) throws java.lang.IllegalArgumentException
Parse a String with aStringWritableCsv
into its composing Strings represented as Strings. No validation is performed on the individual attribute-values returned. Elements are returned starting from the first available attribute-value.- Parameters:
value
- The String with the set of attribute-valuesn
- Number of entries to return (entries will be null of there were not enough). 0 means unlimited- Returns:
- An array of Strings which represent the individual attribute-values
- Throws:
java.lang.IllegalArgumentException
- If value is null or n is negative
-
parseFrom
public static java.lang.String[] parseFrom(java.lang.String value) throws java.lang.IllegalArgumentException
Parse a String with aStringWritableCsv
into its composing Strings represented as Strings. No validation is performed on the individual attribute-values returned. All the available attribute-values will be returned.- Parameters:
value
- The String with the set of attribute-values- Returns:
- An array of Strings which represent the individual attribute-values
- Throws:
java.lang.IllegalArgumentException
- If value is null
-
-