com.camelspotting.jotl.parsing
Class ParseUtil

java.lang.Object
  extended by com.camelspotting.jotl.parsing.ParseUtil

public final class ParseUtil
extends Object

This is a class of static parse support methods, so no methods are visible to applications using jOpenTTDLib.

Version:
1.0
Author:
Eivind Brandth Smedseng, Mats Andreassen

Method Summary
static int locateNextZero(byte[] data, int offset)
          Finds first zero from offset.
static Server parseHost(String host, int port)
          This method checks if host is an IP-address via regex and parses it or if not, does a DNS look up on it.
static String parseString(byte[] data, int offset, int length)
          Method for parsing contents of offset byte array to offset String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

locateNextZero

public static int locateNextZero(byte[] data,
                                 int offset)
Finds first zero from offset.

Parameters:
data - the array to check
offset - where to start
Returns:
the length to the location

parseString

public static String parseString(byte[] data,
                                 int offset,
                                 int length)
Method for parsing contents of offset byte array to offset String.

Parameters:
data - the byte array to read from
offset - where to start
length - where to finish
Returns:
the finished String

parseHost

public static Server parseHost(String host,
                               int port)
                        throws IllegalHostException
This method checks if host is an IP-address via regex and parses it or if not, does a DNS look up on it.

Parameters:
host - the hostname or IP
Returns:
an InetAddress-object
Throws:
UnknownHostException
IllegalHostException


Copyright © 2013. All Rights Reserved.