Package com.globalmentor.io
Class ParseIOException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.io.IOException
-
- com.globalmentor.io.ParseIOException
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
ParseEOFException
,ParseUnexpectedDataException
public class ParseIOException extends java.io.IOException
Exception class for parsing errors that occur during I/O.- See Also:
ParseReader
, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ParseIOException(java.io.Reader reader, java.lang.String message)
Reader and message constructor with no cause.ParseIOException(java.io.Reader reader, java.lang.String message, java.lang.String sourceName)
Reader, message, and source constructor with no cause.ParseIOException(java.io.Reader reader, java.lang.String message, java.lang.Throwable cause)
Reader, message, and cause constructor.ParseIOException(java.io.Reader reader, java.lang.String message, java.lang.Throwable cause, java.lang.String sourceName)
Reader, message, cause, and source constructor.ParseIOException(java.io.Reader reader, java.lang.Throwable cause)
Reader, and cause constructor.ParseIOException(java.io.Reader reader, java.lang.Throwable cause, java.lang.String sourceName)
Reader, cause, and source constructor.ParseIOException(java.lang.String message)
Message constructor with no cause.ParseIOException(java.lang.String message, long lineIndex, long charIndex)
Message and location constructor with no cause.ParseIOException(java.lang.String message, java.lang.String sourceName)
Message and source constructor with no cause.ParseIOException(java.lang.String message, java.lang.String sourceName, long lineIndex, long charIndex)
Message, source, and location constructor with no cause.ParseIOException(java.lang.String message, java.lang.Throwable cause)
Message and cause constructor.ParseIOException(java.lang.String message, java.lang.Throwable cause, long lineIndex, long charIndex)
Message, cause, and location constructor.ParseIOException(java.lang.String message, java.lang.Throwable cause, java.lang.String sourceName)
Message, cause, and source constructor.ParseIOException(java.lang.String message, java.lang.Throwable cause, java.lang.String sourceName, long lineIndex, long charIndex)
Message, cause, source, and location constructor.ParseIOException(java.lang.Throwable cause)
Cause constructor.ParseIOException(java.lang.Throwable cause, long lineIndex, long charIndex)
Cause and location constructor.ParseIOException(java.lang.Throwable cause, java.lang.String sourceName)
Cause and source constructor.ParseIOException(java.lang.Throwable cause, java.lang.String sourceName, long lineIndex, long charIndex)
Cause, source, and location constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.String
convertStringsToMessage(java.util.List<java.lang.String> strings)
Converts an array of strings to a message with the strings separated by commas.protected static java.lang.String
createMessage(java.lang.String message, java.io.Reader reader)
Creates a message for the exception, determining arguments from the given reader if possible.protected static java.lang.String
createMessage(java.lang.String message, java.lang.Throwable cause, java.io.Reader reader)
Creates a message for the exception, determining arguments from the given reader if possible.protected static java.lang.String
createMessage(java.lang.String message, java.lang.Throwable cause, java.lang.String sourceName, long lineIndex, long charIndex)
Creates a message for the exception.protected static long
getCharacterIndex(java.io.Reader reader)
Determines the character index of the given reader if possible.long
getCharIndex()
long
getLineIndex()
protected static long
getLineIndex(java.io.Reader reader)
Determines the line index of the given reader if possible.java.lang.String
getSourceName()
-
-
-
Constructor Detail
-
ParseIOException
public ParseIOException(java.lang.String message)
Message constructor with no cause.- Parameters:
message
- The error message, ornull
if there is no error message.
-
ParseIOException
public ParseIOException(java.lang.Throwable cause)
Cause constructor.- Parameters:
cause
- The cause of the error, ornull
if there is no cause.
-
ParseIOException
public ParseIOException(java.lang.String message, java.lang.Throwable cause)
Message and cause constructor.- Parameters:
message
- The error message, ornull
if there is no error message.cause
- The cause of the error, ornull
if there is no cause.
-
ParseIOException
public ParseIOException(java.lang.String message, java.lang.Throwable cause, java.lang.String sourceName)
Message, cause, and source constructor.- Parameters:
message
- The error message, ornull
if there is no error message.cause
- The cause of the error, ornull
if there is no cause.sourceName
- The name of the source of the data (perhaps a filename), ornull
if not known.
-
ParseIOException
public ParseIOException(java.lang.String message, java.lang.String sourceName, long lineIndex, long charIndex)
Message, source, and location constructor with no cause.- Parameters:
message
- The error message, ornull
if there is no error message.sourceName
- The name of the source of the data (perhaps a filename), ornull
if not known.lineIndex
- The index of the line in which the error occurred, or -1 if not known.charIndex
- The index of the character at which the error occurred on the current line, or -1 if not known.
-
ParseIOException
public ParseIOException(java.lang.Throwable cause, java.lang.String sourceName, long lineIndex, long charIndex)
Cause, source, and location constructor.- Parameters:
cause
- The cause of the error, ornull
if there is no cause.sourceName
- The name of the source of the data (perhaps a filename), ornull
if not known.lineIndex
- The index of the line in which the error occurred, or -1 if not known.charIndex
- The index of the character at which the error occurred on the current line, or -1 if not known.
-
ParseIOException
public ParseIOException(java.io.Reader reader, java.lang.String message)
Reader and message constructor with no cause. This constructor will attempt to determine the location from the reader.- Parameters:
reader
- The reader from which the error occurred.message
- The error message, ornull
if there is no error message.- Throws:
java.lang.NullPointerException
- if the given reader isnull
.- See Also:
LineNumberReader
,ParseReader
-
ParseIOException
public ParseIOException(java.io.Reader reader, java.lang.Throwable cause)
Reader, and cause constructor. This constructor will attempt to determine the location from the reader.- Parameters:
reader
- The reader from which the error occurred.cause
- The cause of the error, ornull
if there is no cause.- Throws:
java.lang.NullPointerException
- if the given reader isnull
.- See Also:
LineNumberReader
,ParseReader
-
ParseIOException
public ParseIOException(java.io.Reader reader, java.lang.String message, java.lang.Throwable cause)
Reader, message, and cause constructor. This constructor will attempt to determine the location from the reader.- Parameters:
reader
- The reader from which the error occurred.message
- The error message, ornull
if there is no error message.cause
- The cause of the error, ornull
if there is no cause.- Throws:
java.lang.NullPointerException
- if the given reader isnull
.- See Also:
LineNumberReader
,ParseReader
-
ParseIOException
public ParseIOException(java.lang.String message, long lineIndex, long charIndex)
Message and location constructor with no cause.- Parameters:
message
- The error message, ornull
if there is no error message.lineIndex
- The index of the line in which the error occurred, or -1 if not known.charIndex
- The index of the character at which the error occurred on the current line, or -1 if not known.
-
ParseIOException
public ParseIOException(java.lang.Throwable cause, long lineIndex, long charIndex)
Cause and location constructor.- Parameters:
cause
- The cause of the error, ornull
if there is no cause.lineIndex
- The index of the line in which the error occurred, or -1 if not known.charIndex
- The index of the character at which the error occurred on the current line, or -1 if not known.
-
ParseIOException
public ParseIOException(java.lang.String message, java.lang.Throwable cause, long lineIndex, long charIndex)
Message, cause, and location constructor.- Parameters:
message
- The error message, ornull
if there is no error message.cause
- The cause of the error, ornull
if there is no cause.lineIndex
- The index of the line in which the error occurred, or -1 if not known.charIndex
- The index of the character at which the error occurred on the current line, or -1 if not known.
-
ParseIOException
public ParseIOException(java.io.Reader reader, java.lang.String message, java.lang.String sourceName)
Reader, message, and source constructor with no cause. This constructor will attempt to determine the location from the reader.- Parameters:
reader
- The reader from which the error occurred.message
- The error message, ornull
if there is no error message.sourceName
- The name of the source of the data (perhaps a filename), ornull
if not known.- Throws:
java.lang.NullPointerException
- if the given reader isnull
.- See Also:
LineNumberReader
,ParseReader
-
ParseIOException
public ParseIOException(java.io.Reader reader, java.lang.Throwable cause, java.lang.String sourceName)
Reader, cause, and source constructor. This constructor will attempt to determine the location from the reader.- Parameters:
reader
- The reader from which the error occurred.cause
- The cause of the error, ornull
if there is no cause.sourceName
- The name of the source of the data (perhaps a filename), ornull
if not known.- Throws:
java.lang.NullPointerException
- if the given reader isnull
.- See Also:
LineNumberReader
,ParseReader
-
ParseIOException
public ParseIOException(java.io.Reader reader, java.lang.String message, java.lang.Throwable cause, java.lang.String sourceName)
Reader, message, cause, and source constructor. This constructor will attempt to determine the location from the reader.- Parameters:
reader
- The reader from which the error occurred.message
- The error message, ornull
if there is no error message.cause
- The cause of the error, ornull
if there is no cause.sourceName
- The name of the source of the data (perhaps a filename), ornull
if not known.- Throws:
java.lang.NullPointerException
- if the given reader isnull
.- See Also:
LineNumberReader
,ParseReader
-
ParseIOException
public ParseIOException(java.lang.String message, java.lang.String sourceName)
Message and source constructor with no cause.- Parameters:
message
- The error message, ornull
if there is no error message.sourceName
- The name of the source of the data (perhaps a filename), ornull
if not known.
-
ParseIOException
public ParseIOException(java.lang.Throwable cause, java.lang.String sourceName)
Cause and source constructor.- Parameters:
cause
- The cause of the error, ornull
if there is no cause.sourceName
- The name of the source of the data (perhaps a filename), ornull
if not known.
-
ParseIOException
public ParseIOException(java.lang.String message, java.lang.Throwable cause, java.lang.String sourceName, long lineIndex, long charIndex)
Message, cause, source, and location constructor.- Parameters:
message
- The error message, ornull
if there is no error message.cause
- The cause of the error, ornull
if there is no cause.sourceName
- The name of the source of the data (perhaps a filename), ornull
if not known.lineIndex
- The index of the line in which the error occurred, or -1 if not known.charIndex
- The index of the character at which the error occurred on the current line, or -1 if not known.
-
-
Method Detail
-
getLineIndex
public long getLineIndex()
- Returns:
- The index of the line on which the error occurred, or -1 if the line index is not known..
- See Also:
getCharIndex()
-
getCharIndex
public long getCharIndex()
- Returns:
- The index of the character at which the error occurred on the current line, or -1 if the character index is not known..
- See Also:
getLineIndex()
-
getSourceName
public java.lang.String getSourceName()
- Returns:
- The name of the source of this exception, such as a filename, or
null
if not known.
-
createMessage
protected static java.lang.String createMessage(java.lang.String message, java.io.Reader reader)
Creates a message for the exception, determining arguments from the given reader if possible.- Parameters:
message
- The error message, ornull
if there is no error message.reader
- The reader that is the source of the message.- Returns:
- A constructed message.
- Throws:
java.lang.NullPointerException
- if the given reader isnull
.- See Also:
getLineIndex(Reader)
,getCharacterIndex(Reader)
-
createMessage
protected static java.lang.String createMessage(java.lang.String message, java.lang.Throwable cause, java.io.Reader reader)
Creates a message for the exception, determining arguments from the given reader if possible.- Parameters:
message
- The error message, ornull
if there is no error message.cause
- The cause of the error, ornull
if there is no cause.reader
- The reader that is the source of the message.- Returns:
- A constructed message.
- Throws:
java.lang.NullPointerException
- if the given reader isnull
.- See Also:
getLineIndex(Reader)
,getCharacterIndex(Reader)
-
createMessage
protected static java.lang.String createMessage(java.lang.String message, java.lang.Throwable cause, java.lang.String sourceName, long lineIndex, long charIndex)
Creates a message for the exception.- Parameters:
message
- The error message, ornull
if there is no error message.cause
- The cause of the error, ornull
if there is no cause.sourceName
- The name of the source of the data (perhaps a filename), ornull
if not known.lineIndex
- The index of the line in which the error occurred, or -1 if not known.charIndex
- The index of the character at which the error occurred on the current line, or -1 if not known.- Returns:
- A constructed message.
- Throws:
java.lang.NullPointerException
- if the given reader isnull
.
-
getLineIndex
protected static long getLineIndex(java.io.Reader reader)
Determines the line index of the given reader if possible.- Parameters:
reader
- The reader from which the line index should be determined.- Returns:
- The line index, or
null
if the line index could not be determined. - Throws:
java.lang.NullPointerException
- if the given reader isnull
.- See Also:
LineNumberReader
,ParseReader
-
getCharacterIndex
protected static long getCharacterIndex(java.io.Reader reader)
Determines the character index of the given reader if possible.- Parameters:
reader
- The reader from which the character index should be determined.- Returns:
- The character index, or
null
if the character index could not be determined. - Throws:
java.lang.NullPointerException
- if the given reader isnull
.- See Also:
ParseReader
-
convertStringsToMessage
public static java.lang.String convertStringsToMessage(@Nonnull java.util.List<java.lang.String> strings)
Converts an array of strings to a message with the strings separated by commas.- Parameters:
strings
- An array of strings to be converted to a string.- Returns:
- The message string constructed
-
-