public class SDDSArray
extends java.lang.Object
Constructor and Description |
---|
SDDSArray()
Create a new SDDS array that can be used to store array information for
SDDS files
|
Modifier and Type | Method and Description |
---|---|
boolean |
deletePage(int page)
Delete a page at the specified index
|
java.lang.String |
getDescription()
Returns the description of the array
|
int[] |
getDim(int page)
Returns the number of elements in each dimension of the array
|
int |
getDimensions()
Returns the number of dimensions in the array
|
int |
getField_Length()
Returns the field length of the array
|
java.lang.String |
getFormat_String()
Returns the format string of the array
|
java.lang.String |
getGroup_Name()
Returns the group name of the array
|
java.lang.String |
getName()
Returns the name of the array
|
int |
getPageCount()
Returns the number of pages that the array contains
|
int |
getRowCount(int page)
Returns the number of rows a page contains
|
java.lang.String |
getSymbol()
Returns the symbol of the array
|
int |
getType()
Returns the type of the array
|
java.lang.String |
getUnits()
Returns the units of the array
|
java.lang.Object[] |
getValues(int page,
boolean string_quotes)
Get the values of the array for a chosen page
|
boolean |
insertPage(int page)
Inserts a blank page at the specified index
|
void |
makeBlankPages(int lastpage)
Create blank pages up to the last page specified
|
void |
setDescription(java.lang.String description)
Set the description of the array
|
void |
setDim(int page,
int[] dim)
Set the number of elements in each dimension of the array
|
void |
setField_Length(int field_length)
Set the field length of the array
|
void |
setFormat_String(java.lang.String format_string)
Set the format string of the array
|
void |
setGroup_Name(java.lang.String group_name)
Set the group name of the array
|
void |
setName(java.lang.String name)
Set the name of the array
|
void |
setSymbol(java.lang.String symbol)
Set the symbol of the array
|
void |
setUnits(java.lang.String units)
Set the units of the array
|
void |
setupArray(java.lang.String name,
java.lang.String symbol,
java.lang.String units,
java.lang.String description,
java.lang.String format_string,
java.lang.String group_name,
int type,
int field_length,
int dimensions)
Set up the array information
|
void |
setValues(double[] v,
int page)
Set the values of the array at a chosen page
|
void |
setValues(long[] v,
int page)
Set the values of the array at a chosen page
|
void |
setValues(java.lang.String[] v,
int page)
Set the values of the array at a chosen page
|
boolean |
writeElement(LEDataOutputStream ledos,
int page)
Write the little endian binary value of the array for a chosen page
|
boolean |
writeHeader(java.io.DataOutputStream dos)
Write the header to a file.
|
boolean |
writeValues(java.io.DataOutputStream dos,
int page,
boolean ascii)
Write the values of the array for a chosen page
|
boolean |
writeValues(LEDataOutputStream ledos,
int page)
Write the values of the array for a chosen page
|
public SDDSArray()
public void setupArray(java.lang.String name, java.lang.String symbol, java.lang.String units, java.lang.String description, java.lang.String format_string, java.lang.String group_name, int type, int field_length, int dimensions)
name
- should be a valid name as defined by
SDDSUtil.isValidNamesymbol
- may be null
units
- may be null
description
- may be null
format_string
- may be null
group_name
- may be null
type
- valid values are:
1
for double2
for float3
for long4
for ulong5
for short6
for ushort7
for string8
for characterfield_length
- has no effect currentlydimensions
- integerpublic java.lang.String getName()
String
value of the array name.public void setName(java.lang.String name)
name
- name of the arraypublic java.lang.String getSymbol()
String
value of the array symbol.public void setSymbol(java.lang.String symbol)
symbol
- symbol of the arraypublic java.lang.String getUnits()
String
value of the array units.public void setUnits(java.lang.String units)
units
- units of the arraypublic java.lang.String getDescription()
String
value of the array description.public void setDescription(java.lang.String description)
description
- description of the arraypublic java.lang.String getFormat_String()
String
value of the array format string.public void setFormat_String(java.lang.String format_string)
format_string
- format string of the arraypublic java.lang.String getGroup_Name()
String
value of the array group name.public void setGroup_Name(java.lang.String group_name)
group_name
- format string of the arraypublic int getType()
int
value of the array type.public int getField_Length()
int
value of the array field length.public void setField_Length(int field_length)
field_length
- field length of the arraypublic int getDimensions()
int
value of the dimensions.public int[] getDim(int page)
page
- index of pageint
array values.public void setDim(int page, int[] dim)
page
- index of pagedim
- format string of the arraypublic int getPageCount()
int
value of the number of pages the array contains.public int getRowCount(int page)
int
value of the number of pages the array contains.-1
if the page value is invalid.public boolean insertPage(int page)
page
- index of page to create inserttrue
on successfalse
on error.public boolean deletePage(int page)
page
- index of page to deletetrue
on successfalse
on error.public void makeBlankPages(int lastpage)
lastpage
- last page to create blank pagepublic boolean writeHeader(java.io.DataOutputStream dos)
dos
- a valid DataOutputStreamtrue
if the header was successfully writtenfalse
if an error occuredpublic void setValues(long[] v, int page)
v
- a long precision number arraypage
- the page of the array, must be greater then 0
public void setValues(double[] v, int page)
v
- a long precision number arraypage
- the page of the array, must be greater then 0
public void setValues(java.lang.String[] v, int page)
v
- a string precision number arraypage
- the page of the array, must be greater then 0
public boolean writeValues(java.io.DataOutputStream dos, int page, boolean ascii)
dos
- a valid DataOutputStreampage
- the page of the array, must be greater then 0
ascii
- set true
to write ascii column data,
false
to write big endian binary array datatrue
if the values were successfully writtenfalse
if an invalid page was encountered or if
the array type is undefined.public boolean writeValues(LEDataOutputStream ledos, int page)
ledos
- a valid DataOutputStreampage
- the page of the array, must be greater then 0
true
if the values were successfully writtenfalse
if an invalid page was encountered or if
the array type is undefined.public boolean writeElement(LEDataOutputStream ledos, int page)
ledos
- a valid LEDataOutputStreampage
- the page of the array, must be greater then 0
true
if the value was successfully writtenfalse
if an invalid page was encountered or if
the array type is undefined.public java.lang.Object[] getValues(int page, boolean string_quotes)
page
- the page of the array, must be greater then 0
string_quotes
- true
if quotes are to be added around stringsfalse
if raw strings are to be outputed.