Package com.mapr.utils
Class SeparatorWriter
java.lang.Object
com.mapr.utils.SeparatorWriter
Assistance for writing separators in strings.
The user indicates if anything has been written and that
a separator is necessary. Then, later, the user can make
a request to write a separator to the string being built,
and it will only be written if a previous request indicated
that separator is necessary.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidIndicate that a separator will be required the next time one is requested.voidRequest to write a separator if one is necessary.
-
Constructor Details
-
SeparatorWriter
Constructor.- Parameters:
sb- the StringBuilder being used to build the StringseparatorStr- the separator string to use
-
-
Method Details
-
needSeparator
public void needSeparator()Indicate that a separator will be required the next time one is requested. If this is not called, then calls towriteSeparator()will do nothing. -
writeSeparator
public void writeSeparator()Request to write a separator if one is necessary. Necessity is determined by a previous call toneedSeparator()that has not yet been fulfilled.
-