UserSpace 類別代表伺服器上的使用者空間。必要的參數是使用者空間的名稱, 和代表具有使用者空間之伺服器的 AS400 物件。
UserSpace 物件需要程式的整合檔案系統路徑名稱。請參閱整合檔案系統路徑名稱,取得詳細資訊。
使用 UserSpace 類別會使得 AS400 物件連接到伺服器。有關管理連線的資訊,請參閱管理連線。
// Create an AS400 object. AS400 sys = new AS400("mySystem.myCompany.com"); // Create a user space object. UserSpace US = new UserSpace(sys, "/QSYS.LIB/MYLIB.LIB/MYSPACE.USRSPC"); // Use the create method to create the user space on // the server. US.create(10240, // The initial size is 10KB true, // Replace if the user space already exists " ", // No extended attribute (byte) 0x00, // The initial value is a null "Created by a Java program", // The description of the user space "*USE"); // Public has use authority to the user space // Use the write method to write bytes to the user space. US.write("Write this string to the user space.", 0);