Top Description Fields Constructors Methods
java.nio.file

public Class InvalidPathException

extends IllegalArgumentException
Class Inheritance

Unchecked exception thrown when path string cannot be converted into a Path because the path string contains invalid characters, or the path string is invalid for other file system specific reasons.
Since
1.7

Field Summary

Modifier and TypeField and Description
private int
index

The index of the input string at which the error occurred or -1 if not known.

private String
input

The input string.

pack-priv static final long

Constructor Summary

AccessConstructor and Description
public
InvalidPathException(String
the input string
input
,
String
a string explaining why the input was rejected
reason
,
int
the index at which the error occurred, or -1 if the index is not known
index
)

Constructs an instance from the given input string, reason, and error index.

public
InvalidPathException(String
the input string
input
,
String
a string explaining why the input was rejected
reason
)

Constructs an instance from the given input string and reason.

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

the error index
getIndex
()

Returns an index into the input string of the position at which the error occurred, or -1 if this position is not known.

public String

Returns:

the input string
getInput
()

Returns the input string.

public String

Returns:

a string describing the error
getMessage
()

Overrides java.lang.Throwable.getMessage.

Returns a string describing the error.

public String

Returns:

the reason string
getReason
()

Returns a string explaining why the input string was rejected.

Field Detail

indexback to summary
private int index

The index of the input string at which the error occurred or -1 if not known.

inputback to summary
private String input

The input string.

serialVersionUIDback to summary
pack-priv static final long serialVersionUID

Hides java.lang.IllegalArgumentException.serialVersionUID.

Annotations
@Serial

Constructor Detail

InvalidPathExceptionback to summary
public InvalidPathException(String input, String reason, int index)

Constructs an instance from the given input string, reason, and error index.

Parameters
input:String

the input string

reason:String

a string explaining why the input was rejected

index:int

the index at which the error occurred, or -1 if the index is not known

Exceptions
NullPointerException:
if either the input or reason strings are null
IllegalArgumentException:
if the error index is less than -1
InvalidPathExceptionback to summary
public InvalidPathException(String input, String reason)

Constructs an instance from the given input string and reason. The resulting object will have an error index of -1.

Parameters
input:String

the input string

reason:String

a string explaining why the input was rejected

Exceptions
NullPointerException:
if either the input or reason strings are null

Method Detail

getIndexback to summary
public int getIndex()

Returns an index into the input string of the position at which the error occurred, or -1 if this position is not known.

Returns:int

the error index

getInputback to summary
public String getInput()

Returns the input string.

Returns:String

the input string

getMessageback to summary
public String getMessage()

Overrides java.lang.Throwable.getMessage.

Returns a string describing the error. The resulting string consists of the reason string followed by a colon character (':'), a space, and the input string. If the error index is defined then the string " at index " followed by the index, in decimal, is inserted after the reason string and before the colon character.

Returns:String

a string describing the error

getReasonback to summary
public String getReason()

Returns a string explaining why the input string was rejected.

Returns:String

the reason string