Class FileUDTValue
- java.lang.Object
-
- de.aristaflow.adept2.model.datamanagement.ADEPT2UDTValue
-
- de.aristaflow.adept2.model.datamanagement.FileUDTValue
-
- All Implemented Interfaces:
UDTValue
,Serializable
public class FileUDTValue extends ADEPT2UDTValue
AFileUDTValue
extends aUDTValue
by file support. A file may be specified via aFileUDTValue.FileDescriptor
of which the content is read and stored in thisUDTValue
. Please note that this is only used for input parameters since all file information is lost as soon as theUDTValue
is stored. This is intended since only the value is relevant in a process context, not where it stems from.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FileUDTValue.FileDescriptor
Represents a file by its name as well as an optional charset which is used to decode the bytes read from the file.
-
Field Summary
Fields Modifier and Type Field Description protected String
fileName
The name of the file this UDT stems from.-
Fields inherited from class de.aristaflow.adept2.model.datamanagement.ADEPT2UDTValue
stream, userDefinedTypeName, value
-
-
Constructor Summary
Constructors Constructor Description FileUDTValue(String userDefinedType, FileUDTValue.FileDescriptor fileDescriptor)
Creates a newFileUDTValue
with the designated user-defined type name and the input of the file represented by the designated file descriptor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
protected static byte[]
getContent(FileUDTValue.FileDescriptor fileDescriptor)
Reads the contents of the file represented by the designated file descriptor.int
hashCode()
String
toString()
-
Methods inherited from class de.aristaflow.adept2.model.datamanagement.ADEPT2UDTValue
finalize, getUserDefinedType, getValueAsArray, getValueAsStream, readStream
-
-
-
-
Field Detail
-
fileName
protected final String fileName
The name of the file this UDT stems from.
-
-
Constructor Detail
-
FileUDTValue
public FileUDTValue(String userDefinedType, FileUDTValue.FileDescriptor fileDescriptor) throws IOException
Creates a newFileUDTValue
with the designated user-defined type name and the input of the file represented by the designated file descriptor.- Parameters:
userDefinedType
- The name of the user-defined type of the value. the name of the user defined typefileDescriptor
- The file descriptor representing a file containing the content for theUDTValue
and the corresponding character set.- Throws:
IOException
- If the designated file can not be read, anIOException
will be thrown.IllegalArgumentException
- If the designated file descriptor does not represent an existing file, anIllegalArgumentException
will be thrown.
-
-
Method Detail
-
getContent
protected static byte[] getContent(FileUDTValue.FileDescriptor fileDescriptor) throws IOException
Reads the contents of the file represented by the designated file descriptor. In case of a character file the read bytes are decoded according to the character set of the file descriptor and stored as UTF-8. Additionally, line breaks are replaced by\n
.- Parameters:
fileDescriptor
- The file descriptor representing a file of which the content is to be read.- Returns:
- The content of the file specified by the designated file descriptor.
- Throws:
IOException
- If the designated file can not be read, anIOException
will be thrown.IllegalArgumentException
- If the designated file descriptor does not represent an existing file, anIllegalArgumentException
will be thrown.
-
toString
public String toString()
- Overrides:
toString
in classADEPT2UDTValue
-
equals
public boolean equals(Object obj)
- Overrides:
equals
in classADEPT2UDTValue
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classADEPT2UDTValue
-
-