All Packages Class Hierarchy This Package Previous Next Index
Class com.ibm.as400.access.UserSpace
java.lang.Object
|
+----com.ibm.as400.access.UserSpace
- public class UserSpace
- extends Object
- implements Serializable
The UserSpace class represents a user space on the AS/400.
-
FORCE_ASYNCHRONOUS
- Force to Auxiliary Storage option that allow changes to be forced asynchronously.
-
FORCE_NONE
- Force to Auxiliary Storage option that does not allow changes to be forced.
-
FORCE_SYNCHRONOUS
- Force to Auxiliary Storage option that allow changes to be forced synchronously.
-
UserSpace()
- Constructs a UserSpace object.
-
UserSpace(AS400, String)
- Constructs a UserSpace object.
-
addPropertyChangeListener(PropertyChangeListener)
- Adds a listener to be notified when the value of any bound property is changed.
-
addUserSpaceListener(UserSpaceListener)
- Adds a listener to be notified when a UserSpaceEvent is fired.
-
addVetoableChangeListener(VetoableChangeListener)
- Adds a listener to be notified when the value of any constrained property is changed.
-
close()
- Closes the user space and releases any system resources associated with the stream.
-
create(int, boolean, String, byte, String, String)
- Creates the user space.
-
create(String, int, boolean, String, byte, String, String)
- Creates the user space.
-
delete()
- Deletes the user space.
-
getInitialValue()
- Returns the initial value used for filling in the user space during creation and extension.
-
getLength()
- Returns the size in bytes of the user space.
-
getName()
- Returns the user space name.
-
getPath()
- Returns the integrated file system path name of the object represented by the user space.
-
getSystem()
- Returns the AS400 system object for the user space.
-
isAutoExtendible()
- Indicates if the user space is auto extendible.
-
read(byte[], int)
- Reads up to dataBuffer.length bytes from the user space beginning at userSpaceOffset
into dataBuffer.
-
read(byte[], int, int, int)
- Reads up to length bytes from the user space beginning at userSpaceOffset into dataBuffer
beginning at dataOffset.
-
read(int, int)
- Returns a string from the user space beginning at userSpaceOffset.
-
removePropertyChangeListener(PropertyChangeListener)
- Removes this listener from being notified when a bound property changes.
-
removeUserSpaceListener(UserSpaceListener)
- Removes a listener from the UserSpace listeners list.
-
removeVetoableChangeListener(VetoableChangeListener)
- Removes this listener from being notified when a constrained property changes.
-
setAutoExtendible(boolean)
- Sets the auto extend attribute if possible.
-
setInitialValue(byte)
- Sets the initial value to be used during user space creation or extension.
-
setLength(int)
- Sets the size of the user space.
-
setPath(String)
- Sets the path for the user space.
-
setSystem(AS400)
- Sets the AS400 system for the user space.
-
write(byte[], int)
- Writes up to dataBuffer.length bytes from dataBuffer into the user space beginning at userSpaceOffset.
-
write(byte[], int, int, int)
- Writes up to length bytes from dataBuffer beginning at dataOffset into the user space beginning at userSpaceOffset.
-
write(byte[], int, int, int, int)
- Writes up to length bytes from dataBuffer beginning at dataOffset into the user
space beginning at userSpaceOffset.
-
write(String, int)
- Writes a string into the user space beginning at userSpaceOffset.
FORCE_ASYNCHRONOUS
public static final int FORCE_ASYNCHRONOUS
- Force to Auxiliary Storage option that allow changes to be forced asynchronously.
FORCE_NONE
public static final int FORCE_NONE
- Force to Auxiliary Storage option that does not allow changes to be forced. It uses normal system writes.
FORCE_SYNCHRONOUS
public static final int FORCE_SYNCHRONOUS
- Force to Auxiliary Storage option that allow changes to be forced synchronously.
UserSpace
public UserSpace()
- Constructs a UserSpace object.
It creates a default UserSpace object. The system and path
properties must be set before attempting a connection.
UserSpace
public UserSpace(AS400 system,
String path)
- Constructs a UserSpace object.
It creates a UserSpace instance that represents the user space path
on system.
- Parameters:
- system - The AS400 that contains the file.
- path - The fully qualified integrated file system path name.
addPropertyChangeListener
public void addPropertyChangeListener(PropertyChangeListener listener)
- Adds a listener to be notified when the value of any bound property is changed.
It can be removed with removePropertyChangeListener.
- Parameters:
- listener - The PropertyChangeListener.
addUserSpaceListener
public void addUserSpaceListener(UserSpaceListener listener)
- Adds a listener to be notified when a UserSpaceEvent is fired.
- Parameters:
- listener - The object listener.
addVetoableChangeListener
public void addVetoableChangeListener(VetoableChangeListener listener)
- Adds a listener to be notified when the value of any constrained property is changed.
- Parameters:
- listener - The VetoableChangeListener.
close
public void close() throws IOException
- Closes the user space and releases any system resources associated with the stream.
create
public void create(int length,
boolean replace,
String extendedAttribute,
byte initialValue,
String textDescription,
String authority) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException
- Creates the user space.
- Parameters:
- length - The initial size in bytes of the user space.
Valid values are 1 through 16,776,704.
- replace - The value indicating if an existing user space is to be replaced.
- extendedAttribute - The user-defined extended attribute of the user space. This string must be 10 characters or less.
- initialValue - The value used in creation and extension.
- textDescription - The text describing the user space. This string must be 50 characters or less.
- authority - The public authority for the user space. This string must be 10 characters or less.
Valid values are:
- *ALL
- *CHANGE
- *EXCLUDE
- *LIBCRTAUT
- *USE
- authorization-list name.
- Throws: AS400SecurityException
- If a security or authority error occurs.
- 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 AS400 object does not exist.
create
public void create(String domain,
int length,
boolean replace,
String extendedAttribute,
byte initialValue,
String textDescription,
String authority) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException
- Creates the user space.
- Parameters:
- domain - The domain into which the user space is created.
Valid value are: *DEFAULT, *USER, or *SYSTEM.
DEFAULT uses the allow user domain system value to determine if *USER or *SYSTEM will be used.
- length - The initial size in bytes of the user space.
Valid values are 1 through 16,776,704.
- replace - The value indicating if an existing user space is to be replaced.
- extendedAttribute - The user-defined extended attribute of the user space. This string must be 10 characters or less.
- initialValue - The value used in creation and extension.
- textDescription - The text describing the user space. This string must be 50 characters or less.
- authority - The authority given to users. This string must be 10 characters or less.
Valid values are:
- *ALL
- *CHANGE
- *EXCLUDE
- *LIBCRTAUT
- *USE
- authorization-list name
- Throws: AS400SecurityException
- If a security or authority error occurs.
- 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 AS400 object does not exist.
delete
public void delete() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException
- Deletes the user space.
- Throws: AS400SecurityException
- If a security or authority error occurs.
- 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 AS400 object does not exist.
getInitialValue
public byte getInitialValue() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException
- Returns the initial value used for filling in the user space during creation and extension.
- Returns:
- The initial value used during user space creation and extension.
- Throws: AS400SecurityException
- If a security or authority error occurs.
- 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 AS400 object does not exist.
getLength
public int getLength() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException
- Returns the size in bytes of the user space.
- Returns:
- The size in bytes of the user space.
- Throws: AS400SecurityException
- If a security or authority error occurs.
- 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 AS400 object does not exist.
getName
public String getName()
- Returns the user space name.
- Returns:
- The name of the user space.
getPath
public String getPath()
- Returns the integrated file system path name of the object represented by the user space.
- Returns:
- The integrated file system path name of the object represented by the user space.
getSystem
public AS400 getSystem()
- Returns the AS400 system object for the user space.
- Returns:
- The AS400 system object for the user space.
isAutoExtendible
public boolean isAutoExtendible() throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException
- Indicates if the user space is auto extendible. When running on a workstation the auto extend
attribute is always true and cannot be changed, so the attribute value returned should be ignored.
The auto extend attribute can be used when running on the AS/400's JVM with the optimizations that
are a part of OS/400.
- Returns:
- true if the user space is auto extendible; false otherwise.
- Throws: AS400SecurityException
- If a security or authority error occurs.
- 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 AS400 object does not exist.
read
public int read(byte dataBuffer[],
int userSpaceOffset) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException
- Reads up to dataBuffer.length bytes from the user space beginning at userSpaceOffset
into dataBuffer.
- Parameters:
- dataBuffer - The position in the data buffer at which results will be place.
- userSpaceOffset - The position in the user space from which to start reading.
- Returns:
- The total number of bytes read into the buffer, or -1 if there is no more data because the end of the user space has been reached.
- Throws: AS400SecurityException
- If a security or authority error occurs.
- 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 AS400 object does not exist.
read
public int read(byte dataBuffer[],
int userSpaceOffset,
int dataOffset,
int length) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException
- Reads up to length bytes from the user space beginning at userSpaceOffset into dataBuffer
beginning at dataOffset.
- Parameters:
- dataBuffer - The position in the data buffer at which results will be place.
- userSpaceOffset - The position in the user space from which to start reading.
- dataOffset - The data starting position for the results of the read.
- length - The number of bytes to be read.
- Returns:
- The total number of bytes read into the buffer, or -1 if there is no more data because the end of user space has been reached.
- Throws: AS400SecurityException
- If a security or authority error occurs.
- 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 AS400 object does not exist.
read
public String read(int userSpaceOffset,
int length) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException
- Returns a string from the user space beginning at userSpaceOffset.
Data is read from the user space as if by the read(byte[],int,int,int) method.
The resulting byte array is then converted into a String.
- Parameters:
- userSpaceOffset - The position in the user space from which to start reading.
- length - The number of bytes from the user space to be read.
- Returns:
- The string value from the user space.
- Throws: AS400SecurityException
- If a security or authority error occurs.
- 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 AS400 object does not exist.
removePropertyChangeListener
public void removePropertyChangeListener(PropertyChangeListener listener)
- Removes this listener from being notified when a bound property changes.
- Parameters:
- listener - The PropertyChangeListener.
removeUserSpaceListener
public void removeUserSpaceListener(UserSpaceListener listener)
- Removes a listener from the UserSpace listeners list.
- Parameters:
- listener - The user space listener.
removeVetoableChangeListener
public void removeVetoableChangeListener(VetoableChangeListener listener)
- Removes this listener from being notified when a constrained property changes.
- Parameters:
- listener - The VetoableChangeListener.
setAutoExtendible
public void setAutoExtendible(boolean autoExtendibility) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException
- Sets the auto extend attribute if possible. When running on a workstation the Toolbox cannot
set the auto extend attribute so this method is ignored and auto extend is always true. Auto
extend can be set when running on the AS/400's JVM with the optimizations that are a part of
OS/400.
- Parameters:
- autoExtendibility - The attribute for user space auto extendibility.
- Throws: AS400SecurityException
- If a security or authority error occurs.
- 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 AS400 object does not exist.
setInitialValue
public void setInitialValue(byte initialValue) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException
- Sets the initial value to be used during user space creation or extension.
- Parameters:
- initialValue - The new initial value used during future extensions.
For best performance set byte to hexadecimal zeros.
- Throws: AS400SecurityException
- If a security or authority error occurs.
- 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 AS400 object does not exist.
setLength
public void setLength(int length) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException
- Sets the size of the user space. Valid values are 1 through 16,776,704.
- Parameters:
- length - The new size of the user space.
- Throws: AS400SecurityException
- If a security or authority error occurs.
- 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 AS400 object does not exist.
setPath
public void setPath(String path) throws PropertyVetoException
- Sets the path for the user space.
The path can only be set before a connection has been established.
- Parameters:
- path - The fully qualified integrated file system path name.
- Throws: PropertyVetoException
- If the change is vetoed.
setSystem
public void setSystem(AS400 system) throws PropertyVetoException
- Sets the AS400 system for the user space.
The system can only be set before a connection has been established.
- Parameters:
- system - The AS400 system.
- Throws: PropertyVetoException
- If the change is vetoed.
write
public void write(byte dataBuffer[],
int userSpaceOffset) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException
- Writes up to dataBuffer.length bytes from dataBuffer into the user space beginning at userSpaceOffset.
- Parameters:
- dataBuffer - The data buffer to be written.
- userSpaceOffset - The position in the user space to start writing.
- Throws: AS400SecurityException
- If a security or authority error occurs.
- 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 AS400 object does not exist.
write
public void write(byte dataBuffer[],
int userSpaceOffset,
int dataOffset,
int length) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException
- Writes up to length bytes from dataBuffer beginning at dataOffset into the user space beginning at userSpaceOffset.
- Parameters:
- dataBuffer - The data buffer to be written.
- userSpaceOffset - The position in the user space to start writing.
- dataOffset - The position in the write data buffer from which to start copying.
- length - The length of data to be written.
- Throws: AS400SecurityException
- If a security or authority error occurs.
- 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 AS400 object does not exist.
write
public void write(byte dataBuffer[],
int userSpaceOffset,
int dataOffset,
int length,
int forceAuxiliary) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException
- Writes up to length bytes from dataBuffer beginning at dataOffset into the user
space beginning at userSpaceOffset.
- Parameters:
- dataBuffer - The data buffer to be written to the user space.
- userSpaceOffset - The position in the user space to start writing.
- dataOffset - The position in the write data buffer from which to start copying.
- length - The length of data to be written.
- forceAuxiliary - The method of forcing changes made to the user space to
auxiliary storage. Valid values are:
- FORCE_NONE
- FORCE_ASYNCHRONOUS
- FORCE_SYNCHRONOUS
- Throws: AS400SecurityException
- If a security or authority error occurs.
- 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 AS400 object does not exist.
write
public void write(String data,
int userSpaceOffset) throws AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException
- Writes a string into the user space beginning at userSpaceOffset.
String is converted into bytes and written to the user space as if by the write(byte[],int) method.
- Parameters:
- data - The data buffer to be written to the user space.
- userSpaceOffset - The position in the user space to start writing.
- Throws: AS400SecurityException
- If a security or authority error occurs.
- 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 AS400 object does not exist.
All Packages Class Hierarchy This Package Previous Next Index