Package com.univocity.parsers.common
Class TextWritingException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.univocity.parsers.common.AbstractException
com.univocity.parsers.common.TextWritingException
- All Implemented Interfaces:
Serializable
Exception type used provide information about any issue that might happen while writing to a given output.
It generally provides location and data information in case of a writing failure.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final String
private final long
private final Object[]
private static final long
Fields inherited from class com.univocity.parsers.common.AbstractException
errorContentLength
-
Constructor Summary
ConstructorsModifierConstructorDescriptionTextWritingException
(String message) Creates a new exception with information about an error that occurred when writing data to some output.TextWritingException
(String message, long line, Object[] row) Creates a new exception with information about an error that occurred when writing data to some output.private
TextWritingException
(String message, long recordCount, Object[] row, String recordCharacters, Throwable cause) Creates a new exception with information about an error that occurred when writing data to some output.TextWritingException
(String message, long recordCount, Object[] row, Throwable cause) Creates a new exception with information about an error that occurred when writing data to some output.TextWritingException
(String message, long line, String recordCharacters) Creates a new exception with information about an error that occurred when writing data to some output.TextWritingException
(String message, long recordCount, String recordCharacters, Throwable cause) Creates a new exception with information about an error that occurred when writing data to some output.TextWritingException
(Throwable cause) Creates a new exception with information about an error that occurred when writing data to some output. -
Method Summary
Modifier and TypeMethodDescriptionprotected String
Subclasses must implement this method to return as much information as possible about the internal state of the parser/writer.protected String
Returns a generic description of the error.Returns the character data that failed to be writtenlong
Returns the number of records written before the exception occurred.Object[]
Returns the data that failed to be writtenMethods inherited from class com.univocity.parsers.common.AbstractException
getMessage, printIfNotEmpty, restrictContent, restrictContent, restrictContent, restrictContent, restrictContent, setErrorContentLength, updateMessage
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
recordCount
private final long recordCount -
recordData
-
recordCharacters
-
-
Constructor Details
-
TextWritingException
private TextWritingException(String message, long recordCount, Object[] row, String recordCharacters, Throwable cause) Creates a new exception with information about an error that occurred when writing data to some output.- Parameters:
message
- message with details about the errorrecordCount
- the number of records written until the error occurredrow
- the input row that was being written when the error occurredrecordCharacters
- the characters already written to the output record.cause
- the cause of the error
-
TextWritingException
public TextWritingException(String message, long recordCount, String recordCharacters, Throwable cause) Creates a new exception with information about an error that occurred when writing data to some output.- Parameters:
message
- message with details about the errorrecordCount
- the number of records written until the error occurredrecordCharacters
- the characters already written to the output record.cause
- the cause of the error
-
TextWritingException
Creates a new exception with information about an error that occurred when writing data to some output.- Parameters:
message
- message with details about the errorrecordCount
- the number of records written until the error occurredrow
- the input row that was being written when the error occurredcause
- the cause of the error
-
TextWritingException
Creates a new exception with information about an error that occurred when writing data to some output.- Parameters:
message
- message with details about the error
-
TextWritingException
Creates a new exception with information about an error that occurred when writing data to some output.- Parameters:
cause
- the cause of the error
-
TextWritingException
Creates a new exception with information about an error that occurred when writing data to some output.- Parameters:
message
- message with details about the errorline
- index of the line being written to the output when the error occurredrow
- the input row that was being written when the error occurred
-
TextWritingException
Creates a new exception with information about an error that occurred when writing data to some output.- Parameters:
message
- message with details about the errorline
- index of the line being written to the output when the error occurredrecordCharacters
- the characters already written to the output record.
-
-
Method Details
-
getRecordCount
public long getRecordCount()Returns the number of records written before the exception occurred.- Returns:
- the number of records written before the exception occurred.
-
getRecordData
Returns the data that failed to be written- Returns:
- the data that failed to be written
-
getRecordCharacters
Returns the character data that failed to be written- Returns:
- the character data that failed to be written
-
getDetails
Description copied from class:AbstractException
Subclasses must implement this method to return as much information as possible about the internal state of the parser/writer. UseAbstractException.printIfNotEmpty(String, String, Object)
to create a comma-separated list of relevant properties and their (non null) values. The result of this method is used by theAbstractException.getMessage()
method to print out these details after the error message.- Specified by:
getDetails
in classAbstractException
- Returns:
- a String describing the internal state of the parser/writer.
-
getErrorDescription
Description copied from class:AbstractException
Returns a generic description of the error. The result of this method is used byAbstractException.getMessage()
to print out a general description of the error before a detailed message of the root cause.- Specified by:
getErrorDescription
in classAbstractException
- Returns:
- a generic description of the error.
-