com.sun.slamd.protocol
Class ClassData

java.lang.Object
  extended by com.sun.slamd.protocol.ClassData

public class ClassData
extends java.lang.Object

This class defines a data structure for holding information about a class transferred from the server to a client.

Author:
Neil A. Wilson

Constructor Summary
ClassData(java.lang.String className, byte[] classBytes)
          Creates a new class data object with the provided information.
 
Method Summary
static ClassData decode(ASN1Element encodedData)
          Decodes the provided ASN.1 element as a set of class data information.
 ASN1Element encode()
          Encodes this class data structure to an ASN.1 element.
 byte[] getClassBytes()
          Retrieves the bytes that comprise the class file.
 java.lang.String getClassName()
          Retrieves the fully-qualified name of the class.
 void setClassBytes(byte[] classBytes)
          Specifies the bytes that comprise the class file.
 void setClassName(java.lang.String className)
          Specifies the fully-qualified name of the class.
 java.lang.String toString()
          Retrieves a string representation of this class data structure.
 void writeClassFile(java.lang.String directory)
          Writes the contents of the class to an appropriate file below the given directory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ClassData

public ClassData(java.lang.String className,
                 byte[] classBytes)
Creates a new class data object with the provided information.

Parameters:
className - The fully-qualified name of the class.
classBytes - The bytes that comprise the class file.
Method Detail

getClassName

public java.lang.String getClassName()
Retrieves the fully-qualified name of the class.

Returns:
The fully-qualified name of the class.

setClassName

public void setClassName(java.lang.String className)
Specifies the fully-qualified name of the class.

Parameters:
className - The fully-qualified name of the class.

getClassBytes

public byte[] getClassBytes()
Retrieves the bytes that comprise the class file.

Returns:
The bytes that comprise the class file.

setClassBytes

public void setClassBytes(byte[] classBytes)
Specifies the bytes that comprise the class file.

Parameters:
classBytes - The bytes that comprise the class file.

writeClassFile

public void writeClassFile(java.lang.String directory)
                    throws java.io.IOException,
                           java.lang.SecurityException
Writes the contents of the class to an appropriate file below the given directory.

Parameters:
directory - The path to the directory below which the class file should be written.
Throws:
java.io.IOException - If an I/O problem occurs while attempting to write the class file.
java.lang.SecurityException - If the security manager will not allow the file to be written.

encode

public ASN1Element encode()
Encodes this class data structure to an ASN.1 element.

Returns:
The ASN.1 element containing the encoded class data structure.

decode

public static ClassData decode(ASN1Element encodedData)
                        throws SLAMDException
Decodes the provided ASN.1 element as a set of class data information.

Parameters:
encodedData - The ASN.1 element containing the data to be decoded.
Returns:
The decoded class data information.
Throws:
SLAMDException - If a problem occurs while attempting to decode the provided element.

toString

public java.lang.String toString()
Retrieves a string representation of this class data structure.

Overrides:
toString in class java.lang.Object
Returns:
A string representation of this class data structure.