Tesseract 3.02

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Static Public Member Functions | Static Public Attributes
com.google.scrollview.ScrollView Class Reference

List of all members.

## 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 | ) |
| inline static

Add a new message to the outgoing queue

Definition at line 60 of file ScrollView.java.

{
if (debugViewNetworkTraffic) {
System.out.println("(S->c) " + e.toString());
}
String str = e.toString();
// Send the whole thing as UTF8.
try {
byte [] utf8 = str.getBytes("UTF8");
out.write(utf8, 0, utf8.length);
} catch (java.io.UnsupportedEncodingException ex) {
System.out.println("Oops... can't encode to UTF8... Exiting");
System.exit(0);
}
out.println();
// Flush the output and check for errors.
boolean error = out.checkError();
if (error) {
System.out.println("Connection error. Quitting ScrollView Server...");
System.exit(0);
}
}

static void com.google.scrollview.ScrollView.exit | ( |  | ) |
| inline static

Called from the client to make the server exit.

Definition at line 379 of file ScrollView.java.

{
System.exit(0);
}

static void com.google.scrollview.ScrollView.main | ( | String[] | args | ) |
| inline static

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

Definition at line 387 of file ScrollView.java.

{
if (args.length > 0) {
SERVER_PORT = Integer.parseInt(args[0]);
}
windows = new ArrayList<SVWindow>(100);
intPattern = Pattern.compile("[0-9-][0-9]*");
floatPattern = Pattern.compile("[0-9-][0-9]*\\.[0-9]*");
try {
// Open a socket to listen on.
ServerSocket serverSocket = new ServerSocket(SERVER_PORT);
System.out.println("Socket started on port " + SERVER_PORT);
// Wait (blocking) for an incoming connection
socket = serverSocket.accept();
System.out.println("Client connected");
// Setup the streams
out = new PrintStream(socket.getOutputStream(), true);
in =
new BufferedReader(new InputStreamReader(socket.getInputStream(),
"UTF8"));
} catch (IOException e) {
// Something went wrong and we were unable to set up a connection. This is
// pretty
// much a fatal error.
// Note: The server does not get restarted automatically if this happens.
e.printStackTrace();
System.exit(1);
}
// Enter the main program loop.
IOLoop();
}

static String com.google.scrollview.ScrollView.receiveMessage | ( |  | ) | throws IOException
| inline static

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

Definition at line 83 of file ScrollView.java.

{
return in.readLine();
}

## 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:

- /mnt/data/src/tesseract-ocr/java/com/google/scrollview/ScrollView.java