public class TargetFile extends java.lang.Object implements MessageBox, java.lang.Cloneable
Constructor and Description |
---|
TargetFile(java.io.File file)
Constructor requires a non null file object.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears all messages.
|
TargetFile |
clone()
Returns a copy of this object.
|
boolean |
equals(java.lang.Object o)
Two target files are equal if the wraped files are equal.
|
void |
error(java.lang.String errorMessage)
Sets an error message for this file.
|
java.nio.charset.Charset |
getCharacterset()
Returns the character set that should be used to read this file.
|
java.nio.charset.Charset |
getDeclaredCharacterset()
Returns the character set of this file, if any was specified.
|
java.lang.String |
getErrorMessage()
Returns the error message if any.
|
java.io.File |
getFile()
Returns the underlying
java.io.File object. |
java.lang.String |
getFileExtension()
Returns the fileExtension as a non null String, separating dot included.
|
java.lang.String |
getInfoMessage()
Returns the info message if any.
|
MimeType |
getMimeType()
Returns the mime type of this file if defined.
|
java.lang.String |
getName()
Returns the file name.
|
java.lang.String |
getNewName()
Returns a planned new name if any was set.
|
java.lang.String |
getPath()
Returns the files directory path.
|
boolean |
hasExtension()
Returns true if the the underlying file object has an extension.
|
int |
hashCode() |
void |
info(java.lang.String message)
Sets an info message for this file.
|
boolean |
isBinaryFile()
Returns true if this TargetFile has an assigned mime type
that represents a binary file type, or if the it has no
assigned mime type at all and the flag
FileType.TREAT_UNKNOWN_AS_BINARY is true. |
boolean |
isCharsetDefined()
Returns true if the character set associate with this file is
specifically defined for this file.
|
boolean |
isIncluded()
Returns true if this file should be considdered part of
a subset in the same collection.
|
boolean |
isSelected()
Returns true (the default) if this file object has bee selected.
|
TargetFile |
merge(java.io.File file)
Returns a copy of this object but with the underlying file object
replaced with the specified file object.
|
void |
setCharacterset(java.nio.charset.Charset charaset)
Specifies a character set for this file.
|
void |
setIncluded(boolean included)
Includes or excludes this object in a subset of the same
collection this instance was taken from.
|
void |
setMimeType(MimeType mimeType)
Explicitely sets a mime type for this file.
|
void |
setNewName(java.lang.String newName)
Sets the new name property of this object.
|
void |
setSelected(boolean select)
Selects or deselects this object.
|
public TargetFile(java.io.File file)
file
- not nullpublic java.lang.String getName()
public java.lang.String getPath()
public java.lang.String getErrorMessage()
public java.lang.String getInfoMessage()
public void error(java.lang.String errorMessage)
error
in interface MessageBox
errorMessage
- error messagepublic void info(java.lang.String message)
info
in interface MessageBox
message
- informative messagepublic void clear()
clear
in interface MessageBox
public java.io.File getFile()
java.io.File
object.File
objectpublic boolean isSelected()
public void setSelected(boolean select)
select
- true if this file object should be selected.public java.lang.String getNewName()
public void setNewName(java.lang.String newName)
newName
- property valuepublic boolean isIncluded()
public void setIncluded(boolean included)
included
- set to false to excluidepublic java.nio.charset.Charset getDeclaredCharacterset()
public java.nio.charset.Charset getCharacterset()
FileType.TREAT_UNKNOWN_AS_BINARY
.public void setCharacterset(java.nio.charset.Charset charaset)
public boolean isCharsetDefined()
public MimeType getMimeType()
public boolean isBinaryFile()
FileType.TREAT_UNKNOWN_AS_BINARY
is true.public java.lang.String getFileExtension()
public boolean hasExtension()
public void setMimeType(MimeType mimeType)
mimeType
- mime typepublic TargetFile clone()
clone
in class java.lang.Object
Object.clone()
public TargetFile merge(java.io.File file)
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
Object.equals(java.lang.Object)
public int hashCode()
hashCode
in class java.lang.Object