Class Entry

  • All Implemented Interfaces:
    java.lang.Comparable<Entry>

    public final class Entry
    extends java.lang.Object
    implements java.lang.Comparable<Entry>
    Represents an OLE 2 compound document entry. This is similar to a file in a file system, or an entry in a ZIP or JAR file.
    Version:
    $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/main/java/com/twelvemonkeys/io/ole2/Entry.java#4 $
    See Also:
    CompoundDocument
    • Constructor Detail

      • Entry

        private Entry()
    • Method Detail

      • readEntry

        static Entry readEntry​(java.io.DataInput pInput)
                        throws java.io.IOException
        Reads an entry from the input.
        Parameters:
        pInput - the input data
        Returns:
        the Entry read from the input data
        Throws:
        java.io.IOException - if an i/o exception occurs during reading
      • read

        private void read​(java.io.DataInput pInput)
                   throws java.io.IOException
        Reads this entry
        Parameters:
        pInput - the input data
        Throws:
        java.io.IOException - if an i/o exception occurs during reading
      • isRoot

        public boolean isRoot()
        If true this Entry is the root Entry.
        Returns:
        true if this is the root Entry
      • isDirectory

        public boolean isDirectory()
        If true this Entry is a directory Entry.
        Returns:
        true if this is a directory Entry
      • isFile

        public boolean isFile()
        If true this Entry is a file (document) Entry.
        Returns:
        true if this is a document Entry
      • getName

        public java.lang.String getName()
        Returns the name of this Entry
        Returns:
        the name of this Entry
      • getInputStream

        public SeekableInputStream getInputStream()
                                           throws java.io.IOException
        Returns the InputStream for this Entry
        Returns:
        an InputStream containing the data for this Entry or null if this is a directory Entry
        Throws:
        java.io.IOException - if an I/O exception occurs
        See Also:
        length()
      • length

        public long length()
        Returns the length of this entry
        Returns:
        the length of the stream for this entry, or 0 if this is a directory Entry
        See Also:
        getInputStream()
      • created

        public long created()
        Returns the time that this entry was created. The time is converted from its internal representation to standard Java representation, milliseconds since the epoch (00:00:00 GMT, January 1, 1970).

        Note that most applications leaves this value empty (0L).

        Returns:
        A long value representing the time this entry was created, measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970), or 0L if no creation time stamp exists for this entry.
      • lastModified

        public long lastModified()
        Returns the time that this entry was last modified. The time is converted from its internal representation to standard Java representation, milliseconds since the epoch (00:00:00 GMT, January 1, 1970).

        Note that many applications leaves this value empty (0L).

        Returns:
        A long value representing the time this entry was last modified, measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970), or 0L if no modification time stamp exists for this entry.
      • getParentEntry

        public Entry getParentEntry()
        Return the parent of this Entry
        Returns:
        the parent of this Entry, or null if this is the root Entry
      • getChildEntry

        public Entry getChildEntry​(java.lang.String pName)
                            throws java.io.IOException
        Returns the child of this Entry with the given name.
        Parameters:
        pName - the name of the child Entry
        Returns:
        the child Entry or null if thee is no such child
        Throws:
        java.io.IOException - if an I/O exception occurs
      • getChildEntries

        public java.util.SortedSet<Entry> getChildEntries()
                                                   throws java.io.IOException
        Returns the children of this Entry.
        Returns:
        a SortedSet of Entry objects
        Throws:
        java.io.IOException - if an I/O exception occurs
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object pOther)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • compareTo

        public int compareTo​(Entry pOther)
        Specified by:
        compareTo in interface java.lang.Comparable<Entry>