Back to index

im-sdk  12.3.91
Public Member Functions | Package Functions | Package Attributes | Private Member Functions
sun.awt.im.iiimp.ProtocolHeader Class Reference

List of all members.

Public Member Functions

void read (IIIMPInputStream in)
void read (IIIMPInputStream in)

Package Functions

 ProtocolHeader ()
 ProtocolHeader (int packet_size, int opCode, int packetLength)
void setPacketSize (int size)
int getPacketSize ()
void setOpCode (int opCode)
int getOpCode ()
void setPacketLength (int length)
int getPacketLength ()
void write (IIIMPOutputStream out)
 ProtocolHeader ()
 ProtocolHeader (int packet_size, int opCode, int packetLength)
void setPacketSize (int size)
int getPacketSize ()
void setOpCode (int opCode)
int getOpCode ()
void setPacketLength (int length)
int getPacketLength ()
void write (IIIMPOutputStream out)

Package Attributes

int packet_size
int opCode
int packetLength

Private Member Functions

void debug (String str)
void debug (String str)

Detailed Description

Definition at line 249 of file Protocol.java.


Constructor & Destructor Documentation

Definition at line 254 of file Protocol.java.

                     {
        packet_size = 0;
        opCode = 0;
        packetLength = 0;
    }
sun.awt.im.iiimp.ProtocolHeader.ProtocolHeader ( int  packet_size,
int  opCode,
int  packetLength 
) [inline, package]

Definition at line 260 of file Protocol.java.

Definition at line 254 of file Protocol.java.

                     {
        packet_size = 0;
        opCode = 0;
        packetLength = 0;
    }
sun.awt.im.iiimp.ProtocolHeader.ProtocolHeader ( int  packet_size,
int  opCode,
int  packetLength 
) [inline, package]

Definition at line 260 of file Protocol.java.


Member Function Documentation

void sun.awt.im.iiimp.ProtocolHeader.debug ( String  str) [inline, private]

Definition at line 346 of file Protocol.java.

                                   {
       if (Manager.DEBUG) {
           System.err.println(str);
       }
    }

Here is the caller graph for this function:

void sun.awt.im.iiimp.ProtocolHeader.debug ( String  str) [inline, private]

Definition at line 346 of file Protocol.java.

                                   {
       if (Manager.DEBUG) {
           System.err.println(str);
       }
    }
int sun.awt.im.iiimp.ProtocolHeader.getOpCode ( ) [inline, package]

Definition at line 278 of file Protocol.java.

                    {
        return opCode;
    }

Here is the caller graph for this function:

int sun.awt.im.iiimp.ProtocolHeader.getOpCode ( ) [inline, package]

Definition at line 278 of file Protocol.java.

                    {
        return opCode;
    }

Definition at line 286 of file Protocol.java.

                          {
        return packetLength;
    }

Definition at line 286 of file Protocol.java.

                          {
        return packetLength;
    }

Definition at line 270 of file Protocol.java.

                        {
        return packet_size;
    }

Definition at line 270 of file Protocol.java.

                        {
        return packet_size;
    }

Definition at line 290 of file Protocol.java.

                                          {
        try {
            int c = in.read();

            int ret = ((c >>> 7) & 0xFF);
            if(ret == 0) {
                packet_size = IIIMProtocol.FOURBYTES_PACKET;
            } else if (ret == 1) {
                packet_size = IIIMProtocol.EIGHTBYTES_PACKET;
            }
            opCode = (c & 0x7f);
            
            int count = 0;
            if(packet_size == IIIMProtocol.FOURBYTES_PACKET) count = 4;
            else if(packet_size == IIIMProtocol.EIGHTBYTES_PACKET) count = 8;
            
            int ch[] = new int[count];
            // Because the first byte is packet_size and opcode,
            // this byte con't calculate for totoal length of protocol
            ch[0] = 0x00;
            
            ch[1] = in.read();
            // O byte protocol
            if(ch[1] == -1) {
                packetLength = 0;
                return;
            }
            
            for(int i=2;i<count;i++) {
                ch[i] = in.read();
            }
            
            
            for(int i = 0 ;i < count; i++) {
                packetLength += (ch[i] << ((count - i - 1) * 8));
            }
            packetLength = (packetLength << 2);
            
        } catch(IOException e) {
            debug("e = " + e);
        }
    }

Here is the call graph for this function:

Definition at line 290 of file Protocol.java.

                                          {
        try {
            int c = in.read();

            int ret = ((c >>> 7) & 0xFF);
            if(ret == 0) {
                packet_size = IIIMProtocol.FOURBYTES_PACKET;
            } else if (ret == 1) {
                packet_size = IIIMProtocol.EIGHTBYTES_PACKET;
            }
            opCode = (c & 0x7f);
            
            int count = 0;
            if(packet_size == IIIMProtocol.FOURBYTES_PACKET) count = 4;
            else if(packet_size == IIIMProtocol.EIGHTBYTES_PACKET) count = 8;
            
            int ch[] = new int[count];
            // Because the first byte is packet_size and opcode,
            // this byte con't calculate for totoal length of protocol
            ch[0] = 0x00;
            
            ch[1] = in.read();
            // O byte protocol
            if(ch[1] == -1) {
                packetLength = 0;
                return;
            }
            
            for(int i=2;i<count;i++) {
                ch[i] = in.read();
            }
            
            
            for(int i = 0 ;i < count; i++) {
                packetLength += (ch[i] << ((count - i - 1) * 8));
            }
            packetLength = (packetLength << 2);
            
        } catch(IOException e) {
            debug("e = " + e);
        }
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void sun.awt.im.iiimp.ProtocolHeader.setOpCode ( int  opCode) [inline, package]

Definition at line 274 of file Protocol.java.

                               {
        this.opCode = opCode;
    }
void sun.awt.im.iiimp.ProtocolHeader.setOpCode ( int  opCode) [inline, package]

Definition at line 274 of file Protocol.java.

                               {
        this.opCode = opCode;
    }
void sun.awt.im.iiimp.ProtocolHeader.setPacketLength ( int  length) [inline, package]

Definition at line 282 of file Protocol.java.

                                     {
        packetLength = length;
    }
void sun.awt.im.iiimp.ProtocolHeader.setPacketLength ( int  length) [inline, package]

Definition at line 282 of file Protocol.java.

                                     {
        packetLength = length;
    }
void sun.awt.im.iiimp.ProtocolHeader.setPacketSize ( int  size) [inline, package]

Definition at line 266 of file Protocol.java.

                                 {
        packet_size = size;
    }
void sun.awt.im.iiimp.ProtocolHeader.setPacketSize ( int  size) [inline, package]

Definition at line 266 of file Protocol.java.

                                 {
        packet_size = size;
    }

Definition at line 333 of file Protocol.java.

                                      {
        try {
            int length = ((packetLength / 4) & 0x00FFFFFF);   
            out.write(opCode & 0x7f);
            out.write((length >>> 16) & 0xFF);
            out.write((length >>> 8)  & 0xFF);
            out.write((length >>> 0)  & 0xFF);
                     
        } catch(IOException e) {
            debug("e = " + e);
        }
    }

Here is the call graph for this function:

Definition at line 333 of file Protocol.java.

                                      {
        try {
            int length = ((packetLength / 4) & 0x00FFFFFF);   
            out.write(opCode & 0x7f);
            out.write((length >>> 16) & 0xFF);
            out.write((length >>> 8)  & 0xFF);
            out.write((length >>> 0)  & 0xFF);
                     
        } catch(IOException e) {
            debug("e = " + e);
        }
    }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 251 of file Protocol.java.

Definition at line 250 of file Protocol.java.

Definition at line 252 of file Protocol.java.


The documentation for this class was generated from the following files: