com.sun.media.jsdt.impl
Class ByteArrayImpl

java.lang.Object
  |
  +--com.sun.media.jsdt.impl.JSDTObject
        |
        +--com.sun.media.jsdt.impl.ManageableImpl
              |
              +--com.sun.media.jsdt.impl.ByteArrayImpl

public class ByteArrayImpl
extends ManageableImpl
implements com.sun.media.jsdt.ByteArray, com.sun.media.jsdt.event.ByteArrayListener

JSDT Byte Array (implementation) class.

Version:
1.5 - 16th February 1999
Author:
Rich Burridge
See Also:
Serialized Form

Field Summary
protected  com.sun.media.jsdt.ByteArrayManager byteArrayManager
          The byte array manager associated with this byte array (if any).
static char M_ByteArray
          To signify a manageable object of type ByteArray.
 AbstractByteArrayProxy po
          Handle to client-side proxy.
 AbstractByteArrayServer so
          Handle to server-side object.
 
Fields inherited from class com.sun.media.jsdt.impl.ManageableImpl
mpo, name, objectType
 
Fields inherited from class com.sun.media.jsdt.impl.JSDTObject
giveTime, httpTunnelPort, maxQueueSize, maxThreadPoolSize, pingPeriod, registryAddress, registryPort, registryTime, showMessage, showStack, socketFactoryClass, SSLCipher, timeoutPeriod, TTL, versionString
 
Constructor Summary
ByteArrayImpl(boolean isServer, java.lang.String name, SessionImpl session, byte[] value)
           ByteArrayImpl the constructor for the ByteArray (implementation) class.
 
Method Summary
 void addByteArrayListener(com.sun.media.jsdt.event.ByteArrayListener listener)
           add the specified ByteArray listener to receive ByteArray events for this ByteArray.
 void byteArrayExpelled(com.sun.media.jsdt.event.ByteArrayEvent event)
           invoked when a Client has been expelled from a ByteArray.
 void byteArrayInvited(com.sun.media.jsdt.event.ByteArrayEvent event)
           invoked when a Client has been invited to join a ByteArray.
 void byteArrayJoined(com.sun.media.jsdt.event.ByteArrayEvent event)
           invoked when a Client has joined a ByteArray.
 void byteArrayLeft(com.sun.media.jsdt.event.ByteArrayEvent event)
           invoked when a Client has left a ByteArray.
 void byteArrayValueChanged(com.sun.media.jsdt.event.ByteArrayEvent event)
           invoked when the value of a ByteArray has changed.
 byte[] getValue()
          Deprecated. There are now three different methods that can be used to return the current value contained in a ByteArray object. The naming of this method is inconsistent with those three methods. As of JSDT 1.5, the preferred way to do this is via the getValueAsBytes() method.
 byte[] getValueAsBytes()
           get the current value for this shared ByteArray, as an array of bytes.
 java.lang.Object getValueAsObject()
           get the current value for this shared ByteArray, as a Java object.
 java.lang.String getValueAsString()
           get the current value for this shared ByteArray, as a String object.
 void removeByteArrayListener(com.sun.media.jsdt.event.ByteArrayListener listener)
           removes the specified ByteArray listener so that it no longer receives ByteArray events for this ByteArray.
 void setLocalValue(byte[] value)
           set the local value for this shared ByteArray.
 void setValue(com.sun.media.jsdt.Client client, byte[] value)
           sets a new value for this shared ByteArray.
 void setValue(com.sun.media.jsdt.Client client, byte[] value, int offset, int length)
           sets a new value for this shared ByteArray using a subset of the given ByteArray.
 void setValue(com.sun.media.jsdt.Client client, java.lang.Object object)
           sets a new value for this shared ByteArray using the given Java object.
 void setValue(com.sun.media.jsdt.Client client, java.lang.String string)
           sets a new value for this shared ByteArray using the given String.
 
Methods inherited from class com.sun.media.jsdt.impl.ManageableImpl
addListener, destroy, disableListenerEvents, disableManagerEvents, enableListenerEvents, enableManagerEvents, expel, getName, getSession, invite, isManaged, join, leave, listClientNames
 
Methods inherited from class com.sun.media.jsdt.impl.JSDTObject
error, getConnectionType, setConnectionType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

M_ByteArray

public static final char M_ByteArray
To signify a manageable object of type ByteArray.

byteArrayManager

protected com.sun.media.jsdt.ByteArrayManager byteArrayManager
The byte array manager associated with this byte array (if any).

po

public AbstractByteArrayProxy po
Handle to client-side proxy.

so

public AbstractByteArrayServer so
Handle to server-side object.
Constructor Detail

ByteArrayImpl

public ByteArrayImpl(boolean isServer,
                     java.lang.String name,
                     SessionImpl session,
                     byte[] value)
ByteArrayImpl the constructor for the ByteArray (implementation) class.
Parameters:
isServer - set if are we creating object on the server-side.
name - the name of the byte array being constructed.
session - the session this byte array belongs to.
value - the initial value to associate with this ByteArray.
Method Detail

getValue

public byte[] getValue()
                throws com.sun.media.jsdt.NoSuchByteArrayException
Deprecated. There are now three different methods that can be used to return the current value contained in a ByteArray object. The naming of this method is inconsistent with those three methods. As of JSDT 1.5, the preferred way to do this is via the getValueAsBytes() method.
get the local value for this shared ByteArray.
Specified by:
getValue in interface com.sun.media.jsdt.ByteArray
Returns:
the local value for this shared byte array.

getValueAsBytes

public byte[] getValueAsBytes()
                       throws com.sun.media.jsdt.NoSuchByteArrayException
get the current value for this shared ByteArray, as an array of bytes.
Specified by:
getValueAsBytes in interface com.sun.media.jsdt.ByteArray
Returns:
the current value of this ByteArray object, as an array of bytes.
Throws:
com.sun.media.jsdt.NoSuchByteArrayException - if this shared ByteArray doesn't exist.

getValueAsObject

public java.lang.Object getValueAsObject()
                                  throws java.lang.ClassNotFoundException,
                                         com.sun.media.jsdt.NoSuchByteArrayException,
                                         java.io.StreamCorruptedException
get the current value for this shared ByteArray, as a Java object.
Specified by:
getValueAsObject in interface com.sun.media.jsdt.ByteArray
Returns:
the current value of this ByteArray object, as a Java object.
Throws:
java.lang.ClassNotFoundException - if the class for this object cannot be found.
com.sun.media.jsdt.NoSuchByteArrayException - if this shared ByteArray doesn't exist.
java.io.StreamCorruptedException - if this Data object does not contain a serialized object.

getValueAsString

public java.lang.String getValueAsString()
                                  throws com.sun.media.jsdt.NoSuchByteArrayException
get the current value for this shared ByteArray, as a String object.
Specified by:
getValueAsString in interface com.sun.media.jsdt.ByteArray
Returns:
the current value of this ByteArray object, as a String object.
Throws:
com.sun.media.jsdt.NoSuchByteArrayException - if this shared ByteArray doesn't exist.

setLocalValue

public void setLocalValue(byte[] value)
set the local value for this shared ByteArray.
Parameters:
value - the new local value for this shared ByteArray.

setValue

public void setValue(com.sun.media.jsdt.Client client,
                     byte[] value)
              throws com.sun.media.jsdt.ConnectionException,
                     com.sun.media.jsdt.InvalidClientException,
                     com.sun.media.jsdt.NoSuchByteArrayException,
                     com.sun.media.jsdt.NoSuchClientException,
                     com.sun.media.jsdt.NoSuchSessionException,
                     com.sun.media.jsdt.PermissionDeniedException,
                     com.sun.media.jsdt.TimedOutException
sets a new value for this shared ByteArray. The new value is sent to all other instances of this shared ByteArray. All ByteArray listeners will have their byteArrayValueChanged method invoked.
Specified by:
setValue in interface com.sun.media.jsdt.ByteArray
Parameters:
client - the Client wishing to set the value of this ByteArray.
value - the new value for this shared ByteArray.
Throws:
com.sun.media.jsdt.ConnectionException - if a connection error occured.
com.sun.media.jsdt.InvalidClientException - if the Client is invalid is some way (ie. its getName() method returns null).
com.sun.media.jsdt.NoSuchByteArrayException - if this shared ByteArray doesn't exist.
com.sun.media.jsdt.NoSuchClientException - if this Client doesn't exist.
com.sun.media.jsdt.NoSuchSessionException - if this Session doesn't exist.
com.sun.media.jsdt.PermissionDeniedException - if this Client does not have permission to change the value of this ByteArray.
com.sun.media.jsdt.TimedOutException - if no reply was received for this operation in the given timeout period.

setValue

public void setValue(com.sun.media.jsdt.Client client,
                     byte[] value,
                     int offset,
                     int length)
              throws com.sun.media.jsdt.ConnectionException,
                     com.sun.media.jsdt.InvalidClientException,
                     com.sun.media.jsdt.NoSuchByteArrayException,
                     com.sun.media.jsdt.NoSuchClientException,
                     com.sun.media.jsdt.NoSuchSessionException,
                     com.sun.media.jsdt.PermissionDeniedException,
                     com.sun.media.jsdt.TimedOutException
sets a new value for this shared ByteArray using a subset of the given ByteArray. The new value is sent to all other instances of this shared ByteArray. All ByteArray listeners will have their byteArrayValueChanged method invoked.
Specified by:
setValue in interface com.sun.media.jsdt.ByteArray
Parameters:
client - the Client wishing to set the value of this ByteArray.
value - the byte array that is the source of the new shared ByteArray value.
offset - the initial offset within the byte array.
length - the number of bytes to use.
Throws:
com.sun.media.jsdt.ConnectionException - if a connection error occured.
com.sun.media.jsdt.InvalidClientException - if the Client is invalid is some way (ie. its getName() method returns null).
com.sun.media.jsdt.NoSuchByteArrayException - if this shared ByteArray doesn't exist.
com.sun.media.jsdt.NoSuchClientException - if this Client doesn't exist.
com.sun.media.jsdt.NoSuchSessionException - if this Session doesn't exist.
com.sun.media.jsdt.PermissionDeniedException - if this Client does not have permission to perform this operation.
com.sun.media.jsdt.TimedOutException - if no reply was received for this operation in the given timeout period.

setValue

public void setValue(com.sun.media.jsdt.Client client,
                     java.lang.String string)
              throws com.sun.media.jsdt.ConnectionException,
                     com.sun.media.jsdt.InvalidClientException,
                     com.sun.media.jsdt.NoSuchByteArrayException,
                     com.sun.media.jsdt.NoSuchClientException,
                     com.sun.media.jsdt.NoSuchSessionException,
                     com.sun.media.jsdt.PermissionDeniedException,
                     com.sun.media.jsdt.TimedOutException
sets a new value for this shared ByteArray using the given String. The new value is sent to all other instances of this shared ByteArray. All ByteArray listeners will have their byteArrayValueChanged method invoked.
Specified by:
setValue in interface com.sun.media.jsdt.ByteArray
Parameters:
client - the Client wishing to set the value of this ByteArray. * @param value the String value from which an array of bytes is set.
Throws:
com.sun.media.jsdt.ConnectionException - if a connection error occured.
com.sun.media.jsdt.InvalidClientException - if the Client is invalid is some way (ie. its getName() method returns null).
com.sun.media.jsdt.NoSuchByteArrayException - if this shared ByteArray doesn't exist.
com.sun.media.jsdt.NoSuchClientException - if this Client doesn't exist.
com.sun.media.jsdt.NoSuchSessionException - if this Session doesn't exist.
com.sun.media.jsdt.PermissionDeniedException - if this Client does not have permission to change the value of this ByteArray.
com.sun.media.jsdt.TimedOutException - if no reply was received for this operation in the given timeout period.

setValue

public void setValue(com.sun.media.jsdt.Client client,
                     java.lang.Object object)
              throws com.sun.media.jsdt.ConnectionException,
                     com.sun.media.jsdt.InvalidClientException,
                     com.sun.media.jsdt.NoSuchByteArrayException,
                     com.sun.media.jsdt.NoSuchClientException,
                     com.sun.media.jsdt.NoSuchSessionException,
                     com.sun.media.jsdt.PermissionDeniedException,
                     com.sun.media.jsdt.TimedOutException
sets a new value for this shared ByteArray using the given Java object. The new value is sent to all other instances of this shared ByteArray. All ByteArray listeners will have their byteArrayValueChanged method invoked.
Specified by:
setValue in interface com.sun.media.jsdt.ByteArray
Parameters:
client - the Client wishing to set the value of this ByteArray. * @param value the Java object value which is serialized into an array of bytes.
Throws:
com.sun.media.jsdt.ConnectionException - if a connection error occured.
com.sun.media.jsdt.InvalidClientException - if the Client is invalid is some way (ie. its getName() method returns null).
com.sun.media.jsdt.NoSuchByteArrayException - if this shared ByteArray doesn't exist.
com.sun.media.jsdt.NoSuchClientException - if this Client doesn't exist.
com.sun.media.jsdt.NoSuchSessionException - if this Session doesn't exist.
com.sun.media.jsdt.PermissionDeniedException - if this Client does not have permission to change the value of this ByteArray.
com.sun.media.jsdt.TimedOutException - if no reply was received for this operation in the given timeout period.

addByteArrayListener

public void addByteArrayListener(com.sun.media.jsdt.event.ByteArrayListener listener)
                          throws com.sun.media.jsdt.ConnectionException,
                                 com.sun.media.jsdt.NoSuchByteArrayException,
                                 com.sun.media.jsdt.NoSuchSessionException,
                                 com.sun.media.jsdt.TimedOutException
add the specified ByteArray listener to receive ByteArray events for this ByteArray.
Specified by:
addByteArrayListener in interface com.sun.media.jsdt.ByteArray
Parameters:
listener - the ByteArray listener.
Throws:
com.sun.media.jsdt.ConnectionException - if a connection error occured.
com.sun.media.jsdt.NoSuchByteArrayException - if this shared ByteArray doesn't exist.
com.sun.media.jsdt.NoSuchSessionException - if this Session doesn't exist.
com.sun.media.jsdt.TimedOutException - if no reply was received for this operation in the given timeout period.

removeByteArrayListener

public void removeByteArrayListener(com.sun.media.jsdt.event.ByteArrayListener listener)
                             throws com.sun.media.jsdt.ConnectionException,
                                    com.sun.media.jsdt.NoSuchByteArrayException,
                                    com.sun.media.jsdt.NoSuchListenerException,
                                    com.sun.media.jsdt.NoSuchSessionException,
                                    com.sun.media.jsdt.TimedOutException
removes the specified ByteArray listener so that it no longer receives ByteArray events for this ByteArray.
Specified by:
removeByteArrayListener in interface com.sun.media.jsdt.ByteArray
Parameters:
listener - the ByteArray listener.
Throws:
com.sun.media.jsdt.ConnectionException - if a connection error occured.
com.sun.media.jsdt.NoSuchByteArrayException - if this shared ByteArray doesn't exist.
com.sun.media.jsdt.NoSuchListenerException - if this ByteArrayListener doesn't exist.
com.sun.media.jsdt.NoSuchSessionException - if this Session doesn't exist.
com.sun.media.jsdt.TimedOutException - if no reply was received for this operation in the given timeout period.

byteArrayJoined

public void byteArrayJoined(com.sun.media.jsdt.event.ByteArrayEvent event)
invoked when a Client has joined a ByteArray.
Specified by:
byteArrayJoined in interface com.sun.media.jsdt.event.ByteArrayListener
Parameters:
event - the ByteArray event containing more information.

byteArrayLeft

public void byteArrayLeft(com.sun.media.jsdt.event.ByteArrayEvent event)
invoked when a Client has left a ByteArray.
Specified by:
byteArrayLeft in interface com.sun.media.jsdt.event.ByteArrayListener
Parameters:
event - the ByteArray event containing more information.

byteArrayValueChanged

public void byteArrayValueChanged(com.sun.media.jsdt.event.ByteArrayEvent event)
invoked when the value of a ByteArray has changed.
Specified by:
byteArrayValueChanged in interface com.sun.media.jsdt.event.ByteArrayListener
Parameters:
event - the ByteArray event containing more information.

byteArrayInvited

public void byteArrayInvited(com.sun.media.jsdt.event.ByteArrayEvent event)
invoked when a Client has been invited to join a ByteArray.
Specified by:
byteArrayInvited in interface com.sun.media.jsdt.event.ByteArrayListener
Parameters:
event - the ByteArray event containing more information.

byteArrayExpelled

public void byteArrayExpelled(com.sun.media.jsdt.event.ByteArrayEvent event)
invoked when a Client has been expelled from a ByteArray.
Specified by:
byteArrayExpelled in interface com.sun.media.jsdt.event.ByteArrayListener
Parameters:
event - the ByteArray event containing more information.