public abstract class DataObject
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.nio.channels.SeekableByteChannel |
channel |
protected DataObjectLocation |
dataObjectLocation |
protected File |
fileObject |
protected java.lang.String |
localIdentifier |
protected java.lang.String |
name |
protected long |
offset |
protected java.net.URL |
parentDir |
Modifier | Constructor and Description |
---|---|
protected |
DataObject(java.io.File parentDir,
File fileObject,
long offset,
long size) |
protected |
DataObject(java.io.File parentDir,
long offset,
long size) |
protected |
DataObject(java.net.URL parentDir,
File fileObject,
long offset,
long size,
DataObjectLocation location) |
protected |
DataObject(java.net.URL parentDir,
File fileObject,
long offset,
long size,
DataObjectLocation location,
java.lang.String name) |
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.
|
DataObjectLocation |
getDataObjectLocation() |
java.io.InputStream |
getInputStream()
Gets an input stream to the data object.
|
java.lang.String |
getLocalIdentifier() |
java.lang.String |
getName() |
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.
|
void |
setDataObjectLocation(DataObjectLocation dataObjectLocation) |
void |
setLocalIdentifier(java.lang.String localIdentifier) |
void |
setName(java.lang.String name) |
protected void |
setSize(long newSize) |
protected java.net.URL parentDir
protected File fileObject
protected long offset
protected java.lang.String name
protected java.lang.String localIdentifier
protected java.nio.channels.SeekableByteChannel channel
protected DataObjectLocation dataObjectLocation
protected DataObject(java.io.File parentDir, long offset, long size) throws java.io.IOException
java.io.IOException
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, DataObjectLocation location) throws java.io.IOException, java.net.URISyntaxException
java.io.IOException
java.net.URISyntaxException
protected DataObject(java.net.URL parentDir, File fileObject, long offset, long size, DataObjectLocation location, java.lang.String name) 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()
public java.lang.String getName()
public void setName(java.lang.String name)
public DataObjectLocation getDataObjectLocation()
public void setDataObjectLocation(DataObjectLocation dataObjectLocation)
public java.lang.String getLocalIdentifier()
public void setLocalIdentifier(java.lang.String localIdentifier)
Copyright © 2023 Planetary Data System. All rights reserved.