iglu.util
Class FileLookup

java.lang.Object
  |
  +--iglu.util.FileLookup

public class FileLookup
extends java.lang.Object

FileLookup creates a lookup table (map) from a delimited file. Each entry in the file has two strings (a key and a value) separated by a pipe (|) character. Pipe characters can optionally be at the beginning and the end of each line.

Author:
Ryan Scherle

Field Summary
private  java.util.HashMap table
           
 
Constructor Summary
FileLookup(java.io.File file)
          Constructs a file lookup item from the given file.
FileLookup(java.lang.String filename)
          Constructs a file lookup item from the given file.
 
Method Summary
 java.lang.String lookup(java.lang.String key)
          Returns the value of the given key.
static void main(java.lang.String[] args)
          Tests the lookup on a file given from the command line.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

table

private java.util.HashMap table
Constructor Detail

FileLookup

public FileLookup(java.lang.String filename)
Constructs a file lookup item from the given file.


FileLookup

public FileLookup(java.io.File file)
Constructs a file lookup item from the given file.

Method Detail

lookup

public java.lang.String lookup(java.lang.String key)
Returns the value of the given key. If the key isn't in the table, returns an empty string.


main

public static void main(java.lang.String[] args)
Tests the lookup on a file given from the command line.