All Packages Class Hierarchy This Package Previous Next Index
Class asjava.uniobjects.UniSequentialFile
java.lang.Object
|
+----asjava.uniobjects.UniBase
|
+----asjava.uniobjects.UniSequentialFile
- public class UniSequentialFile
- extends UniBase
UniSequentialFile
is created via the UniSession.openSequential
method. It is used to define and manage UniVerse Sequential Files, which are operating system
files.
- Version:
- Version 1.0
- Author:
- David T. Meeks
-
uniFileHandle
-
-
close()
- Closes an open sequential file
-
fileSeek(int, int)
- Moves the file pointer within the Sequential File by an offset position specified in bytes,
relative to the current position, beginning of the file, or the end of the file, as determined
by the
aRelPos
parameter.
-
getReadSize()
- returns the current readblock size for this object
-
getTimeout()
- returns the current timeout value for this object
-
isOpen()
- returns whether or not this sequential file is open
-
open()
- physically opens the server-side file, creating it if the CreateFlag value was set and the file
doesn't exist
-
readBlk()
- reads a block of data from the sequential file.
-
readLine()
- reads a line of data from the sequential file.
-
setReadSize(int)
- sets the current ReadSize for this object
-
setTimeout(int)
- sets the current Timeout for this object
-
writeBlk(Object)
- writes the given block to the sequential file, at the location currently set
-
writeEOF()
- writes an EOF marker
-
writeLine(Object)
- writes the given line to the sequential file, at the location currently set
uniFileHandle
protected int uniFileHandle
close
public void close() throws UniSequentialFileException
- Closes an open sequential file
- Throws: UniSequentialFileException
- is thrown if an error occurs
fileSeek
public void fileSeek(int aRelPos,
int aOffset) throws UniSequentialFileException
- Moves the file pointer within the Sequential File by an offset position specified in bytes,
relative to the current position, beginning of the file, or the end of the file, as determined
by the
aRelPos
parameter.
- Parameters:
- aRelPos - integer denoting the relative position within a file to seek from. A 0 (UniT_START)
implies to start from the beginning of the file. 1 (UniT_CURR) means to start from the
current position. 2 (UniT_END) means to start from the end of the file.
- aOffset - integer denoting the number of bytes before or after aRelPos. A negative value
moves the pointer to a position before aRelPos
- Throws: UniSequentialFileException
- if any errors occur
getReadSize
public int getReadSize()
- returns the current readblock size for this object
- Returns:
- integer value representing the current block size to be used when reading blocks of data
- See Also:
- setReadSize
getTimeout
public int getTimeout()
- returns the current timeout value for this object
- Returns:
- integer value representing the current timeout value
- See Also:
- setTimeout
isOpen
public boolean isOpen()
- returns whether or not this sequential file is open
- Returns:
- boolean value denoting whether the file is open.
true
represents the file being open
open
public void open() throws UniSequentialFileException
- physically opens the server-side file, creating it if the CreateFlag value was set and the file
doesn't exist
- Throws: UniSequentialFileException
- is thrown whenever an error occurs
readBlk
public UniString readBlk() throws UniSequentialFileException
- reads a block of data from the sequential file. The size of the data block is defined by what
is set using the
setReadSize
method. Upon completion, the getReadSize
method can be used to determine the number of bytes read. Additionally, the status
method will return one of the following value:
- -1 The file is not open for reading
- 0 The read was successful
- 1 The end of file was reached
- Returns:
- a String value representing the data that was read
- Throws: UniSequentialFileException
- is thrown if an error occurs
readLine
public UniString readLine() throws UniSequentialFileException
- reads a line of data from the sequential file. The lines must be delimited with a newline character.
Additionally, the
status
method will return one of the following values:
- -1 The file is not open for reading
- 0 The read was successful
- 1 The end of file was reached of the
getReadSize
method is 0 or less
- Returns:
- a String value representing the data that was read
- Throws: UniSequentialFileException
- is thrown if an error occurs
setReadSize
public void setReadSize(int aBlockSize)
- sets the current ReadSize for this object
- Parameters:
- aBlockSize - the block size to be set for subsequent read requests
- See Also:
- getReadSize
setTimeout
public void setTimeout(int aTimeOut) throws UniSequentialFileException
- sets the current Timeout for this object
- Parameters:
- aTimeout - the timeout value to be used for read requests
- Throws: UniSequentialFileException
- is thrown if there is an error
- See Also:
- setTimeout
writeBlk
public void writeBlk(Object aString) throws UniSequentialFileException
- writes the given block to the sequential file, at the location currently set
- Parameters:
- aString - a String representing the data block to be written
- Throws: UniSequentialFileException
- is thrown if an error occurs
writeEOF
public void writeEOF() throws UniSequentialFileException
- writes an EOF marker
- Parameters:
- aString - a String representing the data block to be written
- Throws: UniSequentialFileException
- is thrown if an error occurs
writeLine
public void writeLine(Object aString) throws UniSequentialFileException
- writes the given line to the sequential file, at the location currently set
- Parameters:
- aString - a String representing the line to be written
- Throws: UniSequentialFileException
- is thrown if an error occurs
All Packages Class Hierarchy This Package Previous Next Index