Class DataObject

    • Field Detail

      • parentDir

        protected java.net.URL parentDir
      • fileObject

        protected File fileObject
      • offset

        protected long offset
      • name

        protected java.lang.String name
      • localIdentifier

        protected java.lang.String localIdentifier
      • channel

        protected java.nio.channels.SeekableByteChannel channel
    • Constructor Detail

      • DataObject

        protected DataObject​(java.io.File parentDir,
                             long offset,
                             long size)
                      throws java.io.IOException
        Throws:
        java.io.IOException
      • DataObject

        protected DataObject​(java.io.File parentDir,
                             File fileObject,
                             long offset,
                             long size)
                      throws java.io.IOException
        Throws:
        java.io.IOException
      • DataObject

        protected DataObject​(java.net.URL parentDir,
                             File fileObject,
                             long offset,
                             long size,
                             DataObjectLocation location)
                      throws java.io.IOException,
                             java.net.URISyntaxException
        Throws:
        java.io.IOException
        java.net.URISyntaxException
      • DataObject

        protected DataObject​(java.net.URL parentDir,
                             File fileObject,
                             long offset,
                             long size,
                             DataObjectLocation location,
                             java.lang.String name)
                      throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • getDataFile

        public java.net.URL getDataFile()
                                 throws java.net.MalformedURLException
        Gets a url that refers to the data file for this object.
        Returns:
        a URL for the file containing the data object
        Throws:
        java.net.MalformedURLException
      • getOffset

        public long getOffset()
        Gets the offset within the data file where the object data begins.
        Returns:
        the offset to the data
      • getSize

        public long getSize()
        Gets the size of the data object within the data file.
        Returns:
        the size of the data object, in bytes
      • setSize

        protected void setSize​(long newSize)
      • getInputStream

        public java.io.InputStream getInputStream()
                                           throws java.io.IOException
        Gets an input stream to the data object. This input stream will read from the first byte in the data object to the last byte within that object. Other bytes outside of the range for the data object will not be accessed.
        Returns:
        an input stream to the data object
        Throws:
        java.io.FileNotFoundException - if the data file cannot be found
        java.io.IOException - if there is an error reading the data file
      • getChannel

        public java.nio.channels.SeekableByteChannel getChannel()
                                                         throws java.io.IOException
        Gets a SeekableByteChannel for accessing the data object. The channel is read-only, and represents only the portion of the data file containing the data object. You must remember to call the closeChannel() method once reading of the data is finished.
        Returns:
        a SeekableByteChannel for reading bytes from the data object
        Throws:
        java.io.IOException - if there is an error reading the data file
      • closeChannel

        public void closeChannel()
        Closes the underlying channel to the data.
      • getName

        public java.lang.String getName()
      • setName

        public void setName​(java.lang.String name)
      • setDataObjectLocation

        public void setDataObjectLocation​(DataObjectLocation dataObjectLocation)
      • getLocalIdentifier

        public java.lang.String getLocalIdentifier()
      • setLocalIdentifier

        public void setLocalIdentifier​(java.lang.String localIdentifier)