com.ericsson.tic.vi
Class BufferReader

java.lang.Object
  extended by java.util.TimerTask
      extended by com.ericsson.tic.vi.BufferReader
All Implemented Interfaces:
Runnable

public class BufferReader
extends TimerTask

The BufferReader thread continuously reads both the socket buffer and the user input buffer.

Version:
1.0 (2008-12-04)
Author:
Sami Matilainen

Field Summary
private  DatagramPacket packet
          A UDP packet.
private  int portListen
          The port this listener listens on.
private  DatagramSocket socket
          A UDP socket.
private  byte[] tempBuffer
          A temporary buffer.
private  char[] tempCharBuffer
          A temporary buffer.
 
Constructor Summary
BufferReader(int portListen)
          Create a BufferReader and start listening to messages.
 
Method Summary
private  void checkSocketInputBuffer()
          Checks and parses the content of the socket input buffer.
private  void checkUserInputBuffer(RawBuffer buffer)
          Checks and parses the content of the specified user input buffer.
 void run()
          Continuously reads the buffers.
 
Methods inherited from class java.util.TimerTask
cancel, scheduledExecutionTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

portListen

private int portListen
The port this listener listens on.


socket

private DatagramSocket socket
A UDP socket.


packet

private DatagramPacket packet
A UDP packet.


tempBuffer

private byte[] tempBuffer
A temporary buffer.


tempCharBuffer

private char[] tempCharBuffer
A temporary buffer.

Constructor Detail

BufferReader

public BufferReader(int portListen)
             throws SocketException
Create a BufferReader and start listening to messages. Not to be confused with BufferedReader in the Java API.

Throws:
SocketException
Method Detail

run

public void run()
Continuously reads the buffers.

Specified by:
run in interface Runnable
Specified by:
run in class TimerTask

checkUserInputBuffer

private void checkUserInputBuffer(RawBuffer buffer)
Checks and parses the content of the specified user input buffer.

Parameters:
buffer - the buffer which holds messages.

checkSocketInputBuffer

private void checkSocketInputBuffer()
Checks and parses the content of the socket input buffer.