Class FileUDTValue.FileDescriptor

  • All Implemented Interfaces:
    Serializable
    Enclosing class:
    FileUDTValue

    public static class FileUDTValue.FileDescriptor
    extends Object
    implements Serializable
    Represents a file by its name as well as an optional charset which is used to decode the bytes read from the file.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected String charset
      The name of the character set to be used for decoding the bytes read from the file.
      protected String fileName
      The name of the file of this descriptor.
    • Constructor Summary

      Constructors 
      Constructor Description
      FileDescriptor​(String fileName, boolean charContent)
      Creates a new FileDescriptor for the designated file which may be other binary content or character content.
      FileDescriptor​(String fileName, Charset charset)
      Creates a new FileDescriptor for the designated character file with the designated character set for decoding the read bytes.
    • Field Detail

      • fileName

        protected String fileName
        The name of the file of this descriptor.
      • charset

        protected String charset
        The name of the character set to be used for decoding the bytes read from the file.
    • Constructor Detail

      • FileDescriptor

        public FileDescriptor​(String fileName,
                              boolean charContent)
        Creates a new FileDescriptor for the designated file which may be other binary content or character content. If it is character content, UTF-8 will be used for decoding. If you need another decoding use FileDescriptor(String, Charset).
        Parameters:
        fileName - The name of the file the created file descriptor represents.
        charContent - Whether the content of the file is to be interpreted as characters with UTF-8 character set.
      • FileDescriptor

        public FileDescriptor​(String fileName,
                              Charset charset)
        Creates a new FileDescriptor for the designated character file with the designated character set for decoding the read bytes.
        Parameters:
        fileName - The name of the file the created file descriptor represents.
        charset - The character set to be used for decoding the read bytes.
    • Method Detail

      • getFileName

        public String getFileName()
        Gets the name of the file this descriptor represents.
        Returns:
        The name of the file this descriptor represents.
      • getCharset

        public Charset getCharset()
        Gets the character set to be used for decoding the bytes read from the file this descriptor represents. This will be null in case the file is not a character file.
        Returns:
        The character set to be used for decoding the bytes read from the file this descriptor represents or null in case of a non-character file.
      • fileValid

        public boolean fileValid()
        Returns whether this descriptor represents a valid file, that is whether the file with the designated name really exists.
        Returns:
        Whether this descriptor represents a valid file, that is whether the file with the designated name really exists.