Packages
 In this topic

*Constructors

*Methods

 

Packages   PreviousThis PackageNext
Package com.ms.security.permissions   Previous This
Package
Next

 


Class SystemStreamsPermission

public class SystemStreamsPermission implements IPermission, 
            IEncodablePermission
{
  // Constructors
  public SystemStreamsPermission();

  // Methods
  public boolean canSetSystemErr();
  public boolean canSetSystemIn();
  public boolean canSetSystemOut();
  public void check (Object param) throws SecurityException;
  public IPermission combine (IPermission source2);
  public int compareSet (Object target);
  public IPermission copy();
  public boolean decode(String tag, InputStream data);
  public boolean encode(String tag, OutputStream out);
  public String mapFormat(String format);
  public void reset();
  public void setCanSetSystemErr(boolean allow);
  public void setCanSetSystemIn(boolean allow);
  public void setCanSetSystemOut(boolean allow);
  public String[] supportedFormats();
  public String toString();
}

This class represents a permission that controls the ability to change the values of the system streams java.lang.System.in, java.lang.System.out, and java.lang.System.err. The StandardSecurityManager checks for this permission type when performing a checkSystemStreams operation. This class implements the IPermission and IEncodablePermission interfaces.

Constructors

SystemStreamsPermission

public SystemStreamsPermission();

Creates a new SystemStreamsPermission instance.

Remarks:

The new instance does not allow access to any of the system streams. Access to a stream must be explicitly turned on by using one of the setCanSetSystemIn, setCanSetSystemOut, and setCanSetSystemErr methods.

Methods

canSetSystemErr

public boolean canSetSystemErr();

Determines whether the permission object allows the System.err stream to be set.

Return Value:

Returns true if the permission object allows the System.err stream to be set; otherwise, returns false.

canSetSystemIn

public boolean canSetSystemIn();

Determines whether the permission object allows the System.in stream to be set.

Return Value:

Returns true if the permission object allows the System.in stream to be set; otherwise, returns false.

canSetSystemOut

public boolean canSetSystemOut();

Determines whether the permission object allows the System.out stream to be set.

Return Value:

Returns true if the permission object allows the System.out stream to be set; otherwise, returns false.

check

public void check (Object param) throws SecurityException;

Determines whether the permission object allows the specified system stream to be set.

Return Value:

No return value.

ParameterDescription
param The security request parameter. This parameter must be an instance of java.lang.Integer, whose value is interpreted as follows:
0
Indicates an attempt to set System.in.
1
Indicates an attempt to set System.out.
2
Indicates an attempt to set System.err.

Exceptions:

SecurityException if the permission does not allow the specified operation.

combine

public IPermission combine (IPermission source2);

Creates and returns a new SystemStreamsPermission object that is a combination of the current permission object and the specified permission object. The new object allows access to exactly those resources allowed by either one of the permission objects that it was constructed from.

Return Value:

Returns the resulting SystemStreamsPermission object.

ParameterDescription
source2 The SystemStreamsPermission object to combine with.

Exceptions:

IllegalArgumentException if the specified object to combine with is not an instance of SystemStreamsPermission.

compareSet

public int compareSet (Object target);

Compares the SystemStreamsPermission instance with a specified permission object.

Return Value:

Returns one of the following constants:

ParameterDescription
target The permission object that the SystemStreamsPermission instance is compared with.

copy

public IPermission copy();

Retrieves a copy of the SystemStreamsPermission object.

Return Value:

Returns the copy of the SystemStreamsPermission object.

decode

public boolean decode(String tag, InputStream data);

Decodes the contents of the specified data stream into this permission object. The tag parameter specifies the type of data in the stream.

Return Value:

Returns true if the decoding operation succeeded; otherwise, returns false.

ParameterDescription
tag The encoding type identifier.
data The raw data to construct the object from. The type of data is specified by the tag parameter.

encode

public boolean encode(String tag, OutputStream out);

Encodes the contents of this permission object and sends the encoded data to the specified stream. The tag parameter specifies the type of encoding that should be used.

Return Value:

Returns true if the encoding operation succeeded; otherwise, returns false.

ParameterDescription
tag The encoding type identifier.
out The output stream to send the encoded data to.

mapFormat

public String mapFormat(String format);

Retrieves a permission-specific tag, given an encoding format. The tag is then used with the encode and decode methods to specify an encoding type.

Return Value:

Returns the permission-specific tag that corresponds to the specified format.

ParameterDescription
format The encoding format to retrieve the tag for.

reset

public void reset();

Resets the permission object to a state where it does not allow access to any of the system streams.

Return Value:

No return value.

setCanSetSystemErr

public void setCanSetSystemErr(boolean allow);

Sets whether this permission object allows the system stream System.err to be set by classes that possess this permission instance.

Return Value:

No return value.

ParameterDescription
allow The value that indicates whether the permission allows System.err to be set. This value must be set to true if this permission should allow System.err to be set; otherwise, it should be set to false.

setCanSetSystemIn

public void setCanSetSystemIn(boolean allow);

Sets whether this permission object allows the system stream System.in to be set by classes that possess this permission instance.

Return Value:

No return value.

ParameterDescription
allow The value that indicates whether the permission allows System.in to be set. This value must be true if this permission should allow System.in to be set; otherwise, it should be false.

setCanSetSystemOut

public void setCanSetSystemOut(boolean allow);

Sets whether this permission object allows the system stream System.out to be set by classes that possess this permission instance.

Return Value:

No return value.

ParameterDescription
allow The value that indicates whether the permission allows System.out to be set. This value must be true if this permission should allow System.out to be set; otherwise, it should be false.

supportedFormats

public String[] supportedFormats();

Retrieves the encoding formats that the permission type supports.

Return Value:

Returns an array of the supported format identifiers.

toString

public String toString();

Retrieves a textual representation of the permission object.

Return Value:

Returns the string representation of the permission object.

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