All Packages Class Hierarchy This Package Previous Next Index
Class com.ibm.as400.access.CharacterDataArea
java.lang.Object
|
+----com.ibm.as400.access.DataArea
|
+----com.ibm.as400.access.CharacterDataArea
- public class CharacterDataArea
- extends DataArea
- implements Serializable
The CharacterDataArea class represents a character data area on the AS/400.
The following example demonstrates the use of CharacterDataArea:
// Prepare to work with the AS/400 system named "My400".
AS400 system = new AS400("My400");
// Create a CharacterDataArea object.
QSYSObjectPathName path = new QSYSObjectPathName("MYLIB", "MYDATA", "DTAARA");
CharacterDataArea dataArea = new CharacterDataArea(system, path.getPath());
// Create the character data area on the AS/400 using default values.
dataArea.create();
// Clear the data area.
dataArea.clear();
// Write to the data area.
dataArea.write("Hello world");
// Read from the data area.
String data = dataArea.read();
// Delete the data area from the AS/400.
dataArea.delete();
-
CharacterDataArea()
- Constructs a CharacterDataArea object.
-
CharacterDataArea(AS400, String)
- Constructs a CharacterDataArea object.
-
clear()
- Resets the data area to contain all blanks.
-
create()
- Creates a character data area on the AS/400.
-
create(int, String, String, String)
- Creates a character data area with the specified attributes.
-
delete()
- Removes the data area from the system.
-
getPath()
- Returns the integrated file system path name of the object represented by the data area.
-
read()
- Reads the data from the data area.
-
read(int, int)
- Reads the data from the data area.
-
setPath(String)
- Sets the fully qualified data area name.
-
write(String)
- Writes the data to the data area.
-
write(String, int)
- Writes the data to the data area.
CharacterDataArea
public CharacterDataArea()
- Constructs a CharacterDataArea object.
It creates a default CharacterDataArea object. The system and path
properties must be set before attempting a connection.
CharacterDataArea
public CharacterDataArea(AS400 system,
String path)
- Constructs a CharacterDataArea object.
It creates a CharacterDataArea instance that represents the data area path
on system.
- Parameters:
- system - The AS/400 that contains the data area.
- path - The fully qualified integrated file system path name. The
integrated file system file extension for a data area is DTAARA. An example of a
fully qualified integrated file system path to a data area "MYDATA" in library
"MYLIB" is: /QSYS.LIB/MYLIB.LIB/MYDATA.DTAARA
clear
public void clear() throws AS400SecurityException, ConnectionDroppedException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException, ServerStartupException, UnknownHostException
- Resets the data area to contain all blanks.
- Throws: AS400SecurityException
- If a security or authority error occurs.
- Throws: ConnectionDroppedException
- If the connection is dropped unexpectedly.
- Throws: ErrorCompletingRequestException
- If an error occurs before the request is completed.
- Throws: InterruptedException
- If this thread is interrupted.
- Throws: IOException
- If an error occurs while communicating with the AS/400.
- Throws: ObjectDoesNotExistException
- If the AS/400 object does not exist.
- Throws: ServerStartupException
- If the AS/400 server cannot be started.
- Throws: UnknownHostException
- If the AS/400 system cannot be located.
create
public void create() throws AS400SecurityException, ConnectionDroppedException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectAlreadyExistsException, ObjectDoesNotExistException, ServerStartupException, UnknownHostException
- Creates a character data area on the AS/400.
This method uses the following default property values.
- length - 32 characters.
- initialValue - A blank string.
- textDescription - A blank string.
- authority - A value of *LIBCRTAUT.
- Throws: AS400SecurityException
- If a security or authority error occurs.
- Throws: ConnectionDroppedException
- If the connection is dropped unexpectedly.
- Throws: ErrorCompletingRequestException
- If an error occurs before the request is completed.
- Throws: InterruptedException
- If this thread is interrupted.
- Throws: IOException
- If an error occurs while communicating with the AS/400.
- Throws: ObjectAlreadyExistsException
- If the AS/400 object already exists.
- Throws: ObjectDoesNotExistException
- If the AS/400 object does not exist.
- Throws: ServerStartupException
- If the AS/400 server cannot be started.
- Throws: UnknownHostException
- If the AS/400 system cannot be located.
create
public void create(int length,
String initialValue,
String textDescription,
String authority) throws AS400SecurityException, ConnectionDroppedException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectAlreadyExistsException, ObjectDoesNotExistException, ServerStartupException, UnknownHostException
- Creates a character data area with the specified attributes.
- Parameters:
- length - The maximum number of characters in the data area.
Valid values are 1 through 2000.
- initialValue - The initial value for the data area.
- textDescription - The text description for the data area.
The maximum length is 50 characters.
- authority - The public authority level for the data area. Valid
values are *ALL, *CHANGE, *EXCLUDE, *LIBCRTAUT, *USE, or the name
of an authorization list. The maximum length is 10 characters.
- Throws: AS400SecurityException
- If a security or authority error occurs.
- Throws: ConnectionDroppedException
- If the connection is dropped unexpectedly.
- Throws: ErrorCompletingRequestException
- If an error occurs before the request is completed.
- Throws: InterruptedException
- If this thread is interrupted.
- Throws: IOException
- If an error occurs while communicating with the AS/400.
- Throws: ObjectAlreadyExistsException
- If the AS/400 object already exists.
- Throws: ObjectDoesNotExistException
- If the AS/400 object does not exist.
- Throws: ServerStartupException
- If the AS/400 server cannot be started.
- Throws: UnknownHostException
- If the AS/400 system cannot be located.
delete
public void delete() throws AS400SecurityException, ConnectionDroppedException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException, ServerStartupException, UnknownHostException
- Removes the data area from the system.
- Throws: AS400SecurityException
- If a security or authority error occurs.
- Throws: ConnectionDroppedException
- If the connection is dropped unexpectedly.
- Throws: ErrorCompletingRequestException
- If an error occurs before the request is completed.
- Throws: InterruptedException
- If this thread is interrupted.
- Throws: IOException
- If an error occurs while communicating with the AS/400.
- Throws: ObjectDoesNotExistException
- If the object does not exist.
- Throws: ServerStartupException
- If the AS/400 server cannot be started.
- Throws: UnknownHostException
- If the AS/400 system cannot be located.
- Overrides:
- delete in class DataArea
getPath
public String getPath()
- Returns the integrated file system path name of the object represented by the data area.
- Returns:
- The integrated file system path name of the object represented by the data area.
- Overrides:
- getPath in class DataArea
read
public String read() throws AS400SecurityException, ErrorCompletingRequestException, IllegalObjectTypeException, InterruptedException, IOException, ObjectDoesNotExistException
- Reads the data from the data area.
It retrieves the entire contents of the data area. Note that if the data
does not completely fill the data area, this method will return data
containing trailing blanks up to the length of the data area.
- Returns:
- The data read from the data area.
- Throws: AS400SecurityException
- If a security or authority error occurs.
- Throws: ErrorCompletingRequestException
- If an error occurs before the request is completed.
- Throws: IllegalObjectTypeException
- If the AS/400 object is not the required type.
- Throws: InterruptedException
- If this thread is interrupted.
- Throws: IOException
- If an error occurs while communicating with the AS/400.
- Throws: ObjectDoesNotExistException
- If the AS/400 object does not exist.
read
public String read(int dataAreaOffset,
int dataLength) throws AS400SecurityException, ErrorCompletingRequestException, IllegalObjectTypeException, InterruptedException, IOException, ObjectDoesNotExistException
- Reads the data from the data area.
It retrieves dataLength characters beginning at
dataAreaOffset in the data area. The first character in
the data area is at offset 0.
- Parameters:
- dataAreaOffset - The offset in the data area at which to start reading.
- dataLength - The number of characters to read. Valid values are from
1 through (data area size - dataAreaOffset).
- Returns:
- The data read from the data area.
- Throws: AS400SecurityException
- If a security or authority error occurs.
- Throws: ErrorCompletingRequestException
- If an error occurs before the request is completed.
- Throws: IllegalObjectTypeException
- If the AS/400 object is not the required type.
- Throws: InterruptedException
- If this thread is interrupted.
- Throws: IOException
- If an error occurs while communicating with the AS/400.
- Throws: ObjectDoesNotExistException
- If the AS/400 object does not exist.
setPath
public void setPath(String path) throws PropertyVetoException
- Sets the fully qualified data area name.
The following example demonstrates the use of setPath:
// Create a CharacterDataArea object.
CharacterDataArea dataArea = new CharacterDataArea();
// Set its path to be the data area "MYDATA" in the library "MYLIB".
dataArea.setPath("/QSYS.LIB/MYLIB.LIB/MYDATA.DTAARA");
- Parameters:
- path - The fully qualified integrated file system path name of the data area.
- Throws: PropertyVetoException
- If the change is vetoed.
- Overrides:
- setPath in class DataArea
write
public void write(String data) throws AS400SecurityException, ConnectionDroppedException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException, ServerStartupException, UnknownHostException
- Writes the data to the data area.
It writes data to the beginning of the data area. The remaining
characters in the data area are blank padded.
- Parameters:
- data - The data to be written.
- Throws: AS400SecurityException
- If a security or authority error occurs.
- Throws: ConnectionDroppedException
- If the connection is dropped unexpectedly.
- Throws: ErrorCompletingRequestException
- If an error occurs before the request is completed.
- Throws: InterruptedException
- If this thread is interrupted.
- Throws: IOException
- If an error occurs while communicating with the AS/400.
- Throws: ObjectDoesNotExistException
- If the AS/400 object does not exist.
- Throws: ServerStartupException
- If the AS/400 server cannot be started.
- Throws: UnknownHostException
- If the AS/400 system cannot be located.
write
public void write(String data,
int dataAreaOffset) throws AS400SecurityException, ConnectionDroppedException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException, ServerStartupException, UnknownHostException
- Writes the data to the data area.
It writes data.length() characters from data to the
data area beginning at dataAreaOffset. The first character
in the data area is at offset 0.
- Parameters:
- data - The data to be written.
- dataAreaOffset - The offset in the data area at which to start writing.
- Throws: AS400SecurityException
- If a security or authority error occurs.
- Throws: ConnectionDroppedException
- If the connection is dropped unexpectedly.
- Throws: ErrorCompletingRequestException
- If an error occurs before the request is completed.
- Throws: InterruptedException
- If this thread is interrupted.
- Throws: IOException
- If an error occurs while communicating with the AS/400.
- Throws: ObjectDoesNotExistException
- If the AS/400 object does not exist.
- Throws: ServerStartupException
- If the AS/400 server cannot be started.
- Throws: UnknownHostException
- If the AS/400 system cannot be located.
All Packages Class Hierarchy This Package Previous Next Index