Packages
 In this topic

*Methods

 

Packages   PreviousThis PackageNext
Package com.ms.io.clientstorage   Previous This
Package
Next

 


Class ClientStorageManager

public class ClientStorageManager
{
  // Methods
  public static ClientStorageManager getStorageManager ();
  public static ClientStore getStore () throws IOException;
  public ClientStore getStoreForPrincipal (Principal principal,
        ClientStoragePermission data) throws IOException;
  public ClientStore getStoreFromContext () throws IOException;
  public static RandomAccessFile openRandom (String stgfilename,
        boolean writable) throws IOException;
  public static RandomAccessFile openRandom (
        String stgfilename) throws IOException;
  public static RandomAccessFile openRandom (String stgfilename,
        int flags) throws IOException;
  public static InputStream openReadable (String stgfilename,
        int flags) throws IOException;
  public static InputStream openReadable (
        String stgfilename) throws IOException;
  public static OutputStream openWritable (String stgfilename,
        int flags) throws IOException;
  public static OutputStream openWritable (
        String stgfilename) throws IOException;
  public static OutputStream openWritable (String stgfilename,
        boolean append) throws IOException;
}

This class manages the allocation of client stores. The methods of the ClientStorageManager class enable you to obtain the store for a specified principal, get the shared store, or obtain the store for the currently executing principal. You can also open a file for reading or writing, and specify flags that determine the accessibility type. Enforcement of storage limitations for each principal is performed by the ClientStore class.

Methods

getStorageManager

public static ClientStorageManager getStorageManager ();

Obtains the global storage manager.

Return Value:

Returns the global storage manager.

getStore

public static ClientStore getStore () throws IOException;

Obtains the store for the currently executing principal.

Return Value:

Returns the store for the currently executing principal.

Exceptions:

IOException if the context cannot be determined, if no caller has a principal, or if the store for the context does not exist and an error occurs while allocating space for the store.

getStoreForPrincipal

public ClientStore getStoreForPrincipal (Principal principal,
        ClientStoragePermission data) throws IOException;

Retrieves a principal's store.

Return Value:

Returns a store for the specified principal.

ParameterDescription
principal The principal to obtain the store for.
data The default data to give to the principal if the principal does not have a store.

Exceptions:

IOException if an error occurs while allocating space for the store.

getStoreFromContext

public ClientStore getStoreFromContext () throws IOException;

Obtains the store for the currently executing principal. This method scans the current call stack to find the store for the last non-system principal.

Return Value:

Returns the store for the currently executing principal.

Exceptions:

IOException if the context cannot be determined, if no caller has a principal, or if the store for the context does not exist and an error occurs while allocating space for the store.

SecurityException if the caller does not have permission to access the store.

openRandom

public static RandomAccessFile openRandom (String stgfilename,
        boolean writable) throws IOException;

Opens a RandomAccessFile from the store for read or write operations.

Return Value:

Returns the RandomAccessFile that is opened.

ParameterDescription
stgfilename The name of the file to open.
writable Set this value to true if the file should be opened as OPEN_FL_WRITABLE; otherwise, set this value to false.

Exceptions:

IOException if the method fails to open the specified file.

openRandom

public static RandomAccessFile openRandom (String stgfilename)
        throws IOException;

Opens a RandomAccessFile from the store for read operations, with no specified flags.

Return Value:

Returns the RandomAccessFile that is opened.

ParameterDescription
stgfilename The name of the file to open.

Exceptions:

IOException if the method fails to open the specified file.

openRandom

public static RandomAccessFile openRandom (String stgfilename,
        int flags) throws IOException;

Opens a RandomAccessFile from the store for read or write operations.

Return Value:

Returns the RandomAccessFile that is opened.

ParameterDescription
stgfilename The name of the file to open.
flags A value that indicates the requested type of file accessibility. It can be any combination of the following accessibilities:

Exceptions:

IOException if the method fails to create or open the specified file.

openReadable

public static InputStream openReadable (String stgfilename,
        int flags) throws IOException;

Opens a file for reading from the store for the current principal.

Return Value:

Returns the file that is open for reading.

ParameterDescription
stgfilename The name of the file to open.
flags A value that indicates the requested type of file accessibility. It can be any combination of the flags OPEN_FL_SHARED, STORE_FL_ROAMING, or STORE_FL_LOCAL from the ClientStore class.

Exceptions:

IOException if the file does not exist or cannot be opened.

openReadable

public static InputStream openReadable (String stgfilename)
        throws IOException;

Opens a file for reading from the store for the current principal.

Return Value:

Returns the file that is open for reading.

ParameterDescription
stgfilename The name of the file to open.

Exceptions:

IOException if the file does not exist or cannot be opened.

openWritable

public static OutputStream openWritable (String stgfilename,
        int flags) throws IOException;

Opens a file for writing from the store for the current principal. If the file already exists, it is truncated unless the ClientStore.OPEN_FL_APPEND flag is provided.

Return Value:

Returns the output stream that is open for writing.

ParameterDescription
stgfilename The name of the file to open for writing.
flags A value that indicates the requested type of file accessibility. This value can be any combination of the flags OPEN_FL_APPEND, OPEN_FL_SHARED, STORE_FL_ROAMING, or STORE_FL_LOCAL from the ClientStore class.

Exceptions:

IOException if the file could not be created or truncated.

openWritable

public static OutputStream openWritable (String stgfilename)
        throws IOException;

Opens a file for writing from the store for the current principal. If the file already exists, it is truncated.

Return Value:

Returns the file that is open for writing.

ParameterDescription
stgfilename The name of the storage file to open.

Exceptions:

IOException if the file could not be created or truncated.

openWritable

public static OutputStream openWritable (String stgfilename,
        boolean append) throws IOException;

Opens a file for writing from the store for the current principal. If the file already exists, it is truncated or appended.

Return Value:

Returns the file that is open for writing.

ParameterDescription
stgfilename The name of the storage file to open.
append The value that indicates whether to append to an existing file. If the value is true, append to the existing file; otherwise, do not append.

Exceptions:

IOException if the file could not be created or truncated.

upnrm.gif © 1998 Microsoft Corporation. All rights reserved. Terms of use.