Package com.igormaznitsa.jbbp.utils
Interface JBBPTextWriter.Extra
- All Known Implementing Classes:
JBBPTextWriterExtraAdapter
- Enclosing class:
JBBPTextWriter
public static interface JBBPTextWriter.Extra
The Interface describes some extras for the writer which can make
extra-work.
-
Method Summary
Modifier and TypeMethodDescriptiondoConvertByteToStr(JBBPTextWriter context, int value) Convert byte to string representation.doConvertCustomField(JBBPTextWriter context, Object obj, Field field, Bin annotation) Convert a custom field into string.doConvertDoubleToStr(JBBPTextWriter context, double value) Convert double value to string representation.doConvertFloatToStr(JBBPTextWriter context, float value) Convert float value to string representation.doConvertIntToStr(JBBPTextWriter context, int value) Convert integer value to string representation.doConvertLongToStr(JBBPTextWriter context, long value) Convert long value to string representation.doConvertObjToStr(JBBPTextWriter context, int id, Object obj) Convert an object to its string representation.doConvertShortToStr(JBBPTextWriter context, int value) Convert short to string representation.doConvertUIntToStr(JBBPTextWriter context, int value) Convert unsigned integer value to string representation.voidonBeforeFirstValue(JBBPTextWriter context) Notification about print of the first value on the line.voidonClose(JBBPTextWriter context) Notification about closevoidonNewLine(JBBPTextWriter context, int lineNumber) Notification about the start new line.voidNotification that reached defined maximal number of values per string line.
-
Method Details
-
onNewLine
Notification about the start new line.- Parameters:
context- the context, must not be nulllineNumber- the current line number (0 is the first one)- Throws:
IOException- it can be thrown for transport error
-
onBeforeFirstValue
Notification about print of the first value on the line.- Parameters:
context- the context, must not be null- Throws:
IOException- it can be thrown for transport error
-
onReachedMaxValueNumberForLine
Notification that reached defined maximal number of values per string line.- Parameters:
context- the context, must not be null- Throws:
IOException- it can be thrown for transport error
-
onClose
Notification about close- Parameters:
context- the context, must not be null- Throws:
IOException- it can be thrown for transport error
-
doConvertByteToStr
Convert byte to string representation.- Parameters:
context- the context, must not be nullvalue- the unsigned byte value to be converted- Returns:
- string representation of the byte value, must not return null
- Throws:
IOException- it can be thrown for transport error
-
doConvertShortToStr
Convert short to string representation.- Parameters:
context- the context, must not be nullvalue- the unsigned short value to be converted- Returns:
- string representation of the short value, must not return null
- Throws:
IOException- it can be thrown for transport error
-
doConvertIntToStr
Convert integer value to string representation.- Parameters:
context- the context, must not be nullvalue- the integer value to be converted- Returns:
- string representation of the integer value, must not return null
- Throws:
IOException- it can be thrown for transport error
-
doConvertUIntToStr
Convert unsigned integer value to string representation.- Parameters:
context- the context, must not be nullvalue- the unsigned integer value to be converted- Returns:
- string representation of the integer value, must not return null
- Throws:
IOException- it can be thrown for transport error- Since:
- 2.0.4
-
doConvertFloatToStr
Convert float value to string representation.- Parameters:
context- the context, must not be nullvalue- the float value to be converted- Returns:
- string representation of the float value, must not return null
- Throws:
IOException- it can be thrown for transport error- Since:
- 1.4.0
-
doConvertDoubleToStr
Convert double value to string representation.- Parameters:
context- the context, must not be nullvalue- the double value to be converted- Returns:
- string representation of the double value, must not return null
- Throws:
IOException- it can be thrown for transport error- Since:
- 1.4.0
-
doConvertLongToStr
Convert long value to string representation.- Parameters:
context- the context, must not be nullvalue- the long value to be converted- Returns:
- string representation of the long value, must not return null
- Throws:
IOException- it can be thrown for transport error
-
doConvertObjToStr
Convert an object to its string representation.- Parameters:
context- the context, must not be nullid- an optional object idobj- an object to be converted into string, must not be null- Returns:
- string representation of the object
- Throws:
IOException- it can be thrown for transport error
-
doConvertCustomField
String doConvertCustomField(JBBPTextWriter context, Object obj, Field field, Bin annotation) throws IOException Convert a custom field into string.- Parameters:
context- the context, must not be nullobj- an object instance which field must be converted into string, must not be nullfield- the field of the object which must be converted, must not be nullannotation- the bin annotation for the field, must not be null- Returns:
- the text representation of the field or null if to not print anything
- Throws:
IOException- it will be thrown for transport error
-