Tesseract  3.02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
com.google.scrollview.ScrollView Class Reference

Static Public Member Functions

static void addMessage (SVEvent e)
 
static String receiveMessage () throws IOException
 
static void exit ()
 
static void main (String[] args)
 

Static Public Attributes

static int SERVER_PORT = 8461
 
static BufferedReader in
 
static float polylineXCoords []
 
static float polylineYCoords []
 
static int polylineSize
 
static int polylineScanned
 

Detailed Description

The ScrollView class is the main class which gets started from the command line. It sets up LUA and handles the network processing.

Author
wanke.nosp@m.@goo.nosp@m.gle.c.nosp@m.om

Definition at line 32 of file ScrollView.java.

Member Function Documentation

static void com.google.scrollview.ScrollView.addMessage ( SVEvent  e)
inlinestatic

Add a new message to the outgoing queue

Definition at line 60 of file ScrollView.java.

60  {
61  if (debugViewNetworkTraffic) {
62  System.out.println("(S->c) " + e.toString());
63  }
64  String str = e.toString();
65  // Send the whole thing as UTF8.
66  try {
67  byte [] utf8 = str.getBytes("UTF8");
68  out.write(utf8, 0, utf8.length);
69  } catch (java.io.UnsupportedEncodingException ex) {
70  System.out.println("Oops... can't encode to UTF8... Exiting");
71  System.exit(0);
72  }
73  out.println();
74  // Flush the output and check for errors.
75  boolean error = out.checkError();
76  if (error) {
77  System.out.println("Connection error. Quitting ScrollView Server...");
78  System.exit(0);
79  }
80  }
static void com.google.scrollview.ScrollView.exit ( )
inlinestatic

Called from the client to make the server exit.

Definition at line 379 of file ScrollView.java.

379  {
380  System.exit(0);
381  }
static void com.google.scrollview.ScrollView.main ( String[]  args)
inlinestatic

The main function. Sets up LUA and the server connection and then calls the IOLoop.

Definition at line 387 of file ScrollView.java.

387  {
388  if (args.length > 0) {
389  SERVER_PORT = Integer.parseInt(args[0]);
390  }
391  windows = new ArrayList<SVWindow>(100);
392  intPattern = Pattern.compile("[0-9-][0-9]*");
393  floatPattern = Pattern.compile("[0-9-][0-9]*\\.[0-9]*");
394 
395  try {
396  // Open a socket to listen on.
397  ServerSocket serverSocket = new ServerSocket(SERVER_PORT);
398  System.out.println("Socket started on port " + SERVER_PORT);
399 
400  // Wait (blocking) for an incoming connection
401  socket = serverSocket.accept();
402  System.out.println("Client connected");
403 
404  // Setup the streams
405  out = new PrintStream(socket.getOutputStream(), true);
406  in =
407  new BufferedReader(new InputStreamReader(socket.getInputStream(),
408  "UTF8"));
409  } catch (IOException e) {
410  // Something went wrong and we were unable to set up a connection. This is
411  // pretty
412  // much a fatal error.
413  // Note: The server does not get restarted automatically if this happens.
414  e.printStackTrace();
415  System.exit(1);
416  }
417 
418  // Enter the main program loop.
419  IOLoop();
420  }
static BufferedReader in
Definition: ScrollView.java:44
static String com.google.scrollview.ScrollView.receiveMessage ( ) throws IOException
inlinestatic

Read one message from client (assuming there are any).

Definition at line 83 of file ScrollView.java.

83  {
84  return in.readLine();
85  }

Member Data Documentation

BufferedReader com.google.scrollview.ScrollView.in
static

Definition at line 44 of file ScrollView.java.

int com.google.scrollview.ScrollView.polylineScanned
static

Definition at line 48 of file ScrollView.java.

int com.google.scrollview.ScrollView.polylineSize
static

Definition at line 47 of file ScrollView.java.

float com.google.scrollview.ScrollView.polylineXCoords[]
static

Definition at line 45 of file ScrollView.java.

float com.google.scrollview.ScrollView.polylineYCoords[]
static

Definition at line 46 of file ScrollView.java.

int com.google.scrollview.ScrollView.SERVER_PORT = 8461
static

The port our server listens at.

Definition at line 35 of file ScrollView.java.


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