FileInfo is a pair of a file path and the contents of the file.
Its main use case is for actual and expected values in
AssertionFailedError.
The semantics of the path can be defined by the users of this
class.
| Modifier and Type | Field and Description |
|---|---|
| private final byte[] | |
| private final String | |
| private static final long |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | equals(Object
the reference object with which to compare. obj)Overrides java. FileInfo
with the same path and contents as this FileInfo.
|
| public byte[] | |
| public String | Returns: the contents of the file as aString; never nullReturns the contents of the file as a |
| public String | |
| public int | hashCode()
Overrides java. FileInfo based
on its path.
|
| public String | toString()
Overrides java. FileInfo based
on the path and contents.
|
| private static void |
| contents | back to summary |
|---|---|
| private final byte[] contents | |
| path | back to summary |
|---|---|
| private final String path | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| FileInfo | back to summary |
|---|---|
| public FileInfo(String path, byte[] contents) Constructs a Be cautious with large files (limiting the size may be a good idea). The supplied byte array is not copied to avoid unnecessary memory allocations. However, callers of this constructors should not modify the byte array after calling this constructor. This behavior may change in a future release without prior notice.
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj) Overrides java. Determines if the supplied object is an instance of
| |
| getContents | back to summary |
|---|---|
| public byte[] getContents() Returns the contents of the file. This method does currently not return a defensive copy of the contained byte array to avoid unnecessary memory allocations. However, callers of this method should not modify the returned byte array. This behavior may change in a future release without prior notice.
| |
| getContentsAsString | back to summary |
|---|---|
| public String getContentsAsString(Charset charset) Returns the contents of the file as a
| |
| getPath | back to summary |
|---|---|
| public String getPath() Returns the path to the file.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Generates a unique hash code for this
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Generates a string representation of this
| |
| validatePath | back to summary |
|---|---|
| private static void validatePath(String path) | |