Package gov.nasa.pds.label.object
Class ArrayObject
java.lang.Object
gov.nasa.pds.label.object.DataObject
gov.nasa.pds.label.object.ArrayObject
Implements an object representing an array object in a PDS product.
-
Field Summary
Fields inherited from class gov.nasa.pds.label.object.DataObject
channel, dataObjectLocation, fileObject, localIdentifier, name, offset, parentDir -
Constructor Summary
ConstructorsConstructorDescriptionArrayObject(File parentDir, File fileObject, Array array, long offset) Deprecated.ArrayObject(File parentDir, File fileObject, Array array, long offset, DataObjectLocation location) Creats a new array instance.ArrayObject(URL parent, File fileObject, Array array, long offset) Deprecated.ArrayObject(URL parent, File fileObject, Array array, long offset, DataObjectLocation location) Creates a new array instance. -
Method Summary
Modifier and TypeMethodDescriptionReturns a BufferedImage object with the type set to TYPE_BYTE_GRAY.voidclose()getArray()intgetAxes()Gets the number of dimensions.int[]Gets the dimensions of the array.doublegetDouble(int[] position) Gets an array element, as a double.doublegetDouble(int row, int column) Gets an element of a 2-D array, as a double.doublegetDouble(int i1, int i2, int i3) Gets an element of a 3-D array, as a double.doublegetDouble(int i1, int i2, int i3, int i4) Gets an element of a 4-D array, as a double.double[]Gets the entire 1-D array, as doubles.double[][]Gets the entire 2-D array, as doubles.double[][][]Gets the entire 3-D array, as doubles.double[][][][]Gets the entire 4-D array, as doubles.intGets the size of an array element.intgetInt(int[] position) Gets an array element, as an int.intgetInt(int row, int column) Gets an element of a 2-D array, as an int.intgetInt(int i1, int i2, int i3) Gets an element of a 3-D array, as an int.intgetInt(int i1, int i2, int i3, int i4) Gets an element of a 4-D array, as an int.longgetLong(int[] position) Gets an array element, as a long.longgetLong(int row, int column) Gets an element of a 2-D array, as a long.longgetLong(int i1, int i2, int i3) Gets an element of a 3-D array, as a long.longgetLong(int i1, int i2, int i3, int i4) Gets an element of a 4-D array, as a long.booleanisImage()Checks to see whether the array is an image.voidopen()voidMethods inherited from class gov.nasa.pds.label.object.DataObject
closeChannel, getChannel, getDataFile, getDataObjectLocation, getInputStream, getLocalIdentifier, getName, getOffset, getSize, setDataObjectLocation, setLocalIdentifier, setName, setSize
-
Constructor Details
-
ArrayObject
public ArrayObject(File parentDir, File fileObject, Array array, long offset, DataObjectLocation location) throws FileNotFoundException, IOException, URISyntaxException Creats a new array instance.- Parameters:
parentDir- the parent directory for the data filefileObject- the file object metadataarray- the array objectoffset- the offset within the data file- Throws:
IOException- if there is an error opening the data fileFileNotFoundException- if the data file is not foundURISyntaxException
-
ArrayObject
public ArrayObject(URL parent, File fileObject, Array array, long offset, DataObjectLocation location) throws FileNotFoundException, IOException, URISyntaxException Creates a new array instance.- Parameters:
parent- the parent directory for the data filefileObject- the file object metadataarray- the array objectoffset- the offset within the data file- Throws:
IOException- if there is an error opening the data fileFileNotFoundException- if the data file is not foundURISyntaxException
-
ArrayObject
@Deprecated public ArrayObject(URL parent, File fileObject, Array array, long offset) throws FileNotFoundException, IOException, URISyntaxException Deprecated.Deprecated initializer. Missing DataObjectLocation -
ArrayObject
@Deprecated public ArrayObject(File parentDir, File fileObject, Array array, long offset) throws FileNotFoundException, IOException, URISyntaxException Deprecated.Deprecated initializer. Missing DataObjectLocation
-
-
Method Details
-
getDimensions
public int[] getDimensions()Gets the dimensions of the array.- Returns:
- an array of dimensions
-
getAxes
public int getAxes()Gets the number of dimensions.- Returns:
- the number of dimensions
-
getElementSize
public int getElementSize()Gets the size of an array element.- Returns:
- the element size, in bytes
-
getInt
Gets an element of a 2-D array, as an int.- Parameters:
row- the rowcolumn- the column- Returns:
- the element value, as an int
- Throws:
IOException
-
getLong
Gets an element of a 2-D array, as a long.- Parameters:
row- the rowcolumn- the column- Returns:
- the element value, as a long
- Throws:
IOException
-
getDouble
Gets an element of a 2-D array, as a double.- Parameters:
row- the rowcolumn- the column- Returns:
- the element value, as a double
- Throws:
IOException
-
getInt
Gets an element of a 3-D array, as an int.- Parameters:
i1- the first indexi2- the second indexi3- the third index- Returns:
- the element value, as an int
- Throws:
IOException
-
getLong
Gets an element of a 3-D array, as a long.- Parameters:
i1- the first indexi2- the second indexi3- the third index- Returns:
- the element value, as a long
- Throws:
IOException
-
getDouble
Gets an element of a 3-D array, as a double.- Parameters:
i1- the first indexi2- the second indexi3- the third index- Returns:
- the element value, as a double
- Throws:
IOException
-
getInt
Gets an element of a 4-D array, as an int.- Parameters:
i1- the first indexi2- the second indexi3- the third indexi4- the fourth index- Returns:
- the element value, as an int
- Throws:
IOException
-
getLong
Gets an element of a 4-D array, as a long.- Parameters:
i1- the first indexi2- the second indexi3- the third indexi4- the fourth index- Returns:
- the element value, as a long
- Throws:
IOException
-
getDouble
Gets an element of a 4-D array, as a double.- Parameters:
i1- the first indexi2- the second indexi3- the third indexi4- the fourth index- Returns:
- the element value, as a double
- Throws:
IOException
-
getInt
Gets an array element, as an int.- Parameters:
position- the indices of the element- Returns:
- the value of the element, as an int
- Throws:
IOException
-
getLong
Gets an array element, as a long.- Parameters:
position- the indices of the element- Returns:
- the value of the element, as a long
- Throws:
IOException
-
getDouble
Gets an array element, as a double.- Parameters:
position- the indices of the element- Returns:
- the value of the element, as a double
- Throws:
IOException
-
getElements1D
Gets the entire 1-D array, as doubles.- Returns:
- an array of double with all array elements
- Throws:
IOException
-
getElements2D
Gets the entire 2-D array, as doubles.- Returns:
- an array of double with all array elements
- Throws:
IOException
-
getElements3D
Gets the entire 3-D array, as doubles.- Returns:
- an array of double with all array elements
- Throws:
IOException
-
getElements4D
Gets the entire 4-D array, as doubles.- Returns:
- an array of double with all array elements
- Throws:
IOException
-
isImage
public boolean isImage()Checks to see whether the array is an image.- Returns:
- true, if the array is an image
-
as2DImage
Returns a BufferedImage object with the type set to TYPE_BYTE_GRAY.- Returns:
- a BufferedImage
-
getElementType
-
getArray
-
setArray
-
open
- Throws:
IOException
-
close
- Throws:
IOException
-