public abstract class DataObject
extends java.lang.Object
Modifier | Constructor and Description |
---|---|
protected |
DataObject(java.io.File parentDir,
File fileObject,
long offset,
long size) |
protected |
DataObject(java.net.URL parentDir,
File fileObject,
long offset,
long size) |
Modifier and Type | Method and Description |
---|---|
void |
closeChannel()
Closes the underlying channel to the data.
|
java.nio.channels.SeekableByteChannel |
getChannel()
Gets a
SeekableByteChannel for accessing the data object. |
java.net.URL |
getDataFile()
Gets a url that refers to the data file for this object.
|
java.io.InputStream |
getInputStream()
Gets an input stream to the data object.
|
long |
getOffset()
Gets the offset within the data file where the object data begins.
|
long |
getSize()
Gets the size of the data object within the data file.
|
protected void |
setSize(long newSize) |
protected DataObject(java.io.File parentDir, File fileObject, long offset, long size) throws java.io.IOException
java.io.IOException
protected DataObject(java.net.URL parentDir, File fileObject, long offset, long size) throws java.io.IOException
java.io.IOException
public java.net.URL getDataFile() throws java.net.MalformedURLException
URL
for the file containing the data objectjava.net.MalformedURLException
public long getOffset()
public long getSize()
protected void setSize(long newSize)
public java.io.InputStream getInputStream() throws java.io.IOException
java.io.FileNotFoundException
- if the data file cannot be foundjava.io.IOException
- if there is an error reading the data filepublic java.nio.channels.SeekableByteChannel getChannel() throws java.io.IOException
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.SeekableByteChannel
for reading bytes from the
data objectjava.io.IOException
- if there is an error reading the data filepublic void closeChannel()
Copyright © 2010-2018 Planetary Data System. All Rights Reserved.