com.pentec.adapt.afile
Class Ascii

java.lang.Object
  extended by com.pentec.adapt.afile.AFile
      extended by com.pentec.adapt.afile.Ascii

public class Ascii
extends AFile

The Ascii class allows use of the ADAPT AFile interface with ASCII data.

Author:
Pender Technology

Field Summary
private static java.lang.String $XX
           
private static java.lang.String $YY
           
 
Fields inherited from class com.pentec.adapt.afile.AFile
$Value, $X, $Y, ADAPTXY, ASCII, BASLER, CIGARS, COLUMNPROFILE, dataBuffer, fileChooser, FIST1, FIST2, header, iFileType, IMAGE, inputFile, IRIS, iScanSize, isMovie, iVisualizationMode, jfile, mainFrame, MULTISCAN, MULTISLICE, OTHER, POD, progress, REDLAKEMS10, REDLAKEMS8, ROWPROFILE, SAF, SATIRSA, SATIRSB, SINGLE, TPROFILE, UNKNOWN, ZPROFILE
 
Constructor Summary
private Ascii(DataFrame mainFrame, java.io.File file, com.sun.media.jai.codec.FileSeekableStream stream, double[][] aad)
          The private constructor can only be called from the static open method.
 
Method Summary
 APanel getPanel()
           
static boolean open(DataFrame dataFrame, java.io.File file)
          Attempt to open a file as ASCII data.
private static java.util.ArrayList parseTokens(java.lang.String $Text, java.util.ArrayList alTokens)
          Check a string for space, comma, and tab delimeters, then return all parsed tokens in an ArrayList
 int read()
          For this implementation of ASCII input, a single scan is read in at startup.
static double[][] readDelimitedText(java.io.InputStream inputStream)
          Attempt to ready x, y data from an input stream.
private static double[][] readDelimitedText(com.sun.media.jai.codec.SeekableStream seekableStream)
          Attempt to ready x,y data from an input stream.
 
Methods inherited from class com.pentec.adapt.afile.AFile
chooseFile, closeProgress, fileClose, fileExit, fileExit, fileOpen, fileOpen, fileOpen, fileOpen, fileOpen, frameClose, frameClose, getDataBuffer, getDataType, getNumBands, getSampleModel, getScan$, getScanSize, getSlice$, getValue$, getVisualizationMode, getVisualizationMode$, getX$, getY$, isMovie, openProgress, read, setDataBuffer, setLabels, setProgress, setScanSize, setVisualizationMode, setX$, setY$
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

$XX

private static java.lang.String $XX

$YY

private static java.lang.String $YY
Constructor Detail

Ascii

private Ascii(DataFrame mainFrame,
              java.io.File file,
              com.sun.media.jai.codec.FileSeekableStream stream,
              double[][] aad)
The private constructor can only be called from the static open method.

Parameters:
mainFrame - the DataFrame attempting to open a file
file - the file to open
stream - the file input stream
aad - the x and y data arrays
Method Detail

getPanel

public APanel getPanel()
Overrides:
getPanel in class AFile

open

public static boolean open(DataFrame dataFrame,
                           java.io.File file)
Attempt to open a file as ASCII data. For this to succeed, the data must be arranged columns of numbers. Space, comma, or tab delimiters may be used. Column 1 defines X values and remaining columns define Y values. The first line in the file may optionally contain two strings defining the units for each set of values (X first, followed by Y).

Parameters:
dataFrame - the ADAPT data frame attempting to open the file
file - the file to open
Returns:
true if successful, false if not

parseTokens

private static java.util.ArrayList parseTokens(java.lang.String $Text,
                                               java.util.ArrayList alTokens)
Check a string for space, comma, and tab delimeters, then return all parsed tokens in an ArrayList


read

public int read()
For this implementation of ASCII input, a single scan is read in at startup. Other scans that may be present are ignored.

Returns:
zero (0)

readDelimitedText

public static double[][] readDelimitedText(java.io.InputStream inputStream)
Attempt to ready x, y data from an input stream. Strings will be read until a format error occurs, or until EOF.

Parameters:
inputStream - the stream to read from
Returns:
a [][] array of doubles

readDelimitedText

private static double[][] readDelimitedText(com.sun.media.jai.codec.SeekableStream seekableStream)
Attempt to ready x,y data from an input stream. Strings will be read until a format error occurs, or until EOF. The first column is interpreted as x data, and all remaining columns are interpreted as y data.

Parameters:
seekableStream - the stream to read from
Returns:
a [][] array of doubles