Package com.igormaznitsa.jbbp.utils
Class JBBPTextWriterExtraAdapter
java.lang.Object
com.igormaznitsa.jbbp.utils.JBBPTextWriterExtraAdapter
- All Implemented Interfaces:
JBBPTextWriter.Extra
Auxiliary adapter for interface JBBPTextWriter.Extra.
- Since:
- 1.1
- See Also:
-
Constructor Summary
Constructors -
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.
-
Constructor Details
-
JBBPTextWriterExtraAdapter
public JBBPTextWriterExtraAdapter()
-
-
Method Details
-
onNewLine
Description copied from interface:JBBPTextWriter.ExtraNotification about the start new line.- Specified by:
onNewLinein interfaceJBBPTextWriter.Extra- 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
Description copied from interface:JBBPTextWriter.ExtraNotification about print of the first value on the line.- Specified by:
onBeforeFirstValuein interfaceJBBPTextWriter.Extra- Parameters:
context- the context, must not be null- Throws:
IOException- it can be thrown for transport error
-
onClose
Description copied from interface:JBBPTextWriter.ExtraNotification about close- Specified by:
onClosein interfaceJBBPTextWriter.Extra- Parameters:
context- the context, must not be null- Throws:
IOException- it can be thrown for transport error
-
doConvertByteToStr
Description copied from interface:JBBPTextWriter.ExtraConvert byte to string representation.- Specified by:
doConvertByteToStrin interfaceJBBPTextWriter.Extra- 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
Description copied from interface:JBBPTextWriter.ExtraConvert short to string representation.- Specified by:
doConvertShortToStrin interfaceJBBPTextWriter.Extra- 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
-
doConvertFloatToStr
Description copied from interface:JBBPTextWriter.ExtraConvert float value to string representation.- Specified by:
doConvertFloatToStrin interfaceJBBPTextWriter.Extra- 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
-
doConvertDoubleToStr
Description copied from interface:JBBPTextWriter.ExtraConvert double value to string representation.- Specified by:
doConvertDoubleToStrin interfaceJBBPTextWriter.Extra- 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
-
doConvertIntToStr
Description copied from interface:JBBPTextWriter.ExtraConvert integer value to string representation.- Specified by:
doConvertIntToStrin interfaceJBBPTextWriter.Extra- 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
-
doConvertLongToStr
Description copied from interface:JBBPTextWriter.ExtraConvert long value to string representation.- Specified by:
doConvertLongToStrin interfaceJBBPTextWriter.Extra- 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
Description copied from interface:JBBPTextWriter.ExtraConvert an object to its string representation.- Specified by:
doConvertObjToStrin interfaceJBBPTextWriter.Extra- 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
public String doConvertCustomField(JBBPTextWriter context, Object obj, Field field, Bin annotation) throws IOException Description copied from interface:JBBPTextWriter.ExtraConvert a custom field into string.- Specified by:
doConvertCustomFieldin interfaceJBBPTextWriter.Extra- 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
-
onReachedMaxValueNumberForLine
Description copied from interface:JBBPTextWriter.ExtraNotification that reached defined maximal number of values per string line.- Specified by:
onReachedMaxValueNumberForLinein interfaceJBBPTextWriter.Extra- Parameters:
context- the context, must not be null- Throws:
IOException- it can be thrown for transport error
-
doConvertUIntToStr
Description copied from interface:JBBPTextWriter.ExtraConvert unsigned integer value to string representation.- Specified by:
doConvertUIntToStrin interfaceJBBPTextWriter.Extra- 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
-