public abstract class DataObject extends Object
Modifier | Constructor and Description |
---|---|
protected |
DataObject(File parentDir,
File fileObject,
long offset,
long size) |
protected |
DataObject(URL parentDir,
File fileObject,
long offset,
long size) |
Modifier and Type | Method and Description |
---|---|
void |
closeChannel()
Closes the underlying channel to the data.
|
SeekableByteChannel |
getChannel()
Gets a
SeekableByteChannel for accessing the data object. |
URL |
getDataFile()
Gets a url that refers to the data file for this object.
|
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(File parentDir, File fileObject, long offset, long size) throws IOException
IOException
protected DataObject(URL parentDir, File fileObject, long offset, long size) throws IOException
IOException
public URL getDataFile() throws MalformedURLException
URL
for the file containing the data objectMalformedURLException
public long getOffset()
public long getSize()
protected void setSize(long newSize)
public InputStream getInputStream() throws IOException
FileNotFoundException
- if the data file cannot be foundIOException
- if there is an error reading the data filepublic SeekableByteChannel getChannel() throws 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 objectIOException
- if there is an error reading the data filepublic void closeChannel()
Copyright © 2010–2018 Planetary Data System. All rights reserved.