Class FileEntry

  • All Implemented Interfaces:
    VFSEntry, Serializable
    Direct Known Subclasses:
    QDLScript

    public class FileEntry
    extends Object
    implements VFSEntry
    Generic entry for the virtual file system. Note that these are not designed to be mutable. If there is a write, just replace this object with a new one.

    Created by Jeff Gaynor
    on 2/19/20 at 5:58 AM

    See Also:
    Serialized Form
    • Field Detail

      • CONTENT

        public static String CONTENT
      • CONTENT_TYPE

        public static String CONTENT_TYPE
      • TEXT_TYPE

        public static String TEXT_TYPE
      • BINARY_TYPE

        public static String BINARY_TYPE
      • INPUT_STREAM_TYPE

        public static String INPUT_STREAM_TYPE
      • TYPE

        public static String TYPE
    • Constructor Detail

      • FileEntry

        public FileEntry​(edu.uiuc.ncsa.security.core.configuration.XProperties xp)
      • FileEntry

        public FileEntry​(byte[] bytes)
      • FileEntry

        public FileEntry​(byte[] bytes,
                         edu.uiuc.ncsa.security.core.configuration.XProperties xp)
      • FileEntry

        public FileEntry​(List<String> lines)
      • FileEntry

        public FileEntry​(String lines)
      • FileEntry

        public FileEntry​(List<String> lines,
                         edu.uiuc.ncsa.security.core.configuration.XProperties xp)
      • FileEntry

        public FileEntry​(InputStream inputStream,
                         edu.uiuc.ncsa.security.core.configuration.XProperties xp)
    • Method Detail

      • hasContent

        public boolean hasContent()
      • getBytes

        public byte[] getBytes()
        Specified by:
        getBytes in interface VFSEntry
      • setBytes

        public void setBytes​(byte[] bytes)
      • setLines

        public void setLines​(List<String> lines)
      • getText

        public String getText​(String regexFilter)
        Filters lines. If a line matches the regex, then it is omitted.
        Specified by:
        getText in interface VFSEntry
        Parameters:
        regexFilter -
        Returns:
      • getProperties

        public edu.uiuc.ncsa.security.core.configuration.XProperties getProperties()
        These properties are for external systems that must manage when or how the scripts are run. For instance, if there is a version of the script. QDL does not care what version the author has of this, but it must be preserved. These are set and managed externally -- QDL itself never touches these or cares about them.
        Specified by:
        getProperties in interface VFSEntry
        Returns:
      • setProperties

        public void setProperties​(edu.uiuc.ncsa.security.core.configuration.XProperties xp)
        Specified by:
        setProperties in interface VFSEntry
      • setInputStream

        public void setInputStream​(InputStream inputStream)
      • getInputStream

        public InputStream getInputStream()
        In the case of actual files, the reader will be set to a Reader. In other cases (such as from a zip file or collection of lines in a memory VFS) about the best we can do is return a reader for iterating. Note that you should get this once and use it until you close it. This is because there are no well defined ways in Java to check if a generic InputStream has been closed without trying something (like reading some bytes) and seeing if it throws an exception. Therefore, this will take the backing set of lines and return a new byte array output stream every time.
        Specified by:
        getInputStream in interface VFSEntry
        Returns: