package com.google.code.hs4j.example;

import java.net.InetSocketAddress;

import com.google.code.hs4j.HSClient;
import com.google.code.hs4j.impl.HSClientImpl;

public class HS4JExample {
	public static void main(String[] args) throws Exception {
		// [48, 9, 43, 9, 50, 9, 100, 101, 110, 110, 105, 115, 9, 107, 105, 108,
		// 108, 109, 101, 50, 48, 48, 56, 64, 103, 109, 97, 105, 108, 46, 99,
		// 111, 109, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0]
		HSClient client = new HSClientImpl(new InetSocketAddress(9999),20);
//		final String[] fieldList = { "user_id", "user_name", "user_email",
//				"created" };
//		System.out.println(client.openIndex(0, "mytest", "user", "INDEX_01",
//				fieldList));
//		String[] values = { "kevin" };
//		ResultSet rs = client.find(0, values);
//		while (rs.next()) {
//			System.out.println(rs.getString("user_name"));
//			System.out.println(rs.getString("user_email"));
//			System.out.println(rs.getString("user_id"));
//			System.out.println(rs.getTimestamp("created"));
//		}
//		values = new String[] { "4", "dennis", "test@gmail.com" };
//		System.out.println(client.insert(0, values));
//
//		values = new String[] { "dennis" };
//		// for (int i = 0; i < 1000; i++) {
//		rs = client.find(0, values);
//		while (rs.next()) {
//			System.out.println(rs.getString("user_name"));
//			System.out.println(rs.getString("user_email"));
//			System.out.println(rs.getTimestamp("created"));
//		}
//		// }
//
//		System.out.println(client.delete(0, values, FindOperator.EQ));
//		rs = client.find(0, values);
//		while (rs.next()) {
//			System.out.println(rs.getString("user_name"));
//			System.out.println(rs.getString("user_email"));
//			// System.out.println(rs.getString("created"));
//		}
//		client.shutdown();
	}
}

@@ -67,16 +67,85 @@
 ddress;%0A
+import java.sql.ResultSet;%0A%0Aimport com.google.code.hs4j.FindOperator;
 %0Aimport 
@@ -571,15 +571,14 @@
 99),
+ 
 20);%0A
-//
 %09%09fi
@@ -642,18 +642,16 @@
 email%22,%0A
-//
 %09%09%09%09%22cre
@@ -655,26 +655,24 @@
 created%22 %7D;%0A
-//
 %09%09System.out
@@ -730,18 +730,16 @@
 EX_01%22,%0A
-//
 %09%09%09%09fiel
@@ -747,18 +747,16 @@
 List));%0A
-//
 %09%09String
@@ -780,18 +780,16 @@
 vin%22 %7D;%0A
-//
 %09%09Result
@@ -813,34 +813,32 @@
 ind(0, values);%0A
-//
 %09%09while (rs.next
@@ -835,34 +835,32 @@
 e (rs.next()) %7B%0A
-//
 %09%09%09System.out.pr
@@ -885,34 +885,32 @@
 (%22user_name%22));%0A
-//
 %09%09%09System.out.pr
@@ -936,34 +936,32 @@
 %22user_email%22));%0A
-//
 %09%09%09System.out.pr
@@ -988,26 +988,24 @@
 user_id%22));%0A
-//
 %09%09%09System.ou
@@ -1043,24 +1043,20 @@
 ted%22));%0A
-//
 %09%09%7D%0A
-//
 %09%09values
@@ -1108,18 +1108,16 @@
 com%22 %7D;%0A
-//
 %09%09System
@@ -1156,21 +1156,17 @@
 lues));%0A
-//%0A//
+%0A
 %09%09values
@@ -1195,18 +1195,16 @@
 nis%22 %7D;%0A
-//
 %09%09// for
@@ -1233,18 +1233,16 @@
  i++) %7B%0A
-//
 %09%09rs = c
@@ -1256,34 +1256,32 @@
 ind(0, values);%0A
-//
 %09%09while (rs.next
@@ -1278,34 +1278,32 @@
 e (rs.next()) %7B%0A
-//
 %09%09%09System.out.pr
@@ -1328,34 +1328,32 @@
 (%22user_name%22));%0A
-//
 %09%09%09System.out.pr
@@ -1383,26 +1383,24 @@
 r_email%22));%0A
-//
 %09%09%09System.ou
@@ -1442,28 +1442,20 @@
 ));%0A
-//
 %09%09%7D%0A
-//
 %09%09// %7D%0A
-//%0A//
+%0A
 %09%09Sy
@@ -1515,18 +1515,16 @@
 r.EQ));%0A
-//
 %09%09rs = c
@@ -1546,18 +1546,16 @@
 alues);%0A
-//
 %09%09while 
@@ -1568,18 +1568,16 @@
 xt()) %7B%0A
-//
 %09%09%09Syste
@@ -1618,18 +1618,16 @@
 ame%22));%0A
-//
 %09%09%09Syste
@@ -1669,18 +1669,16 @@
 ail%22));%0A
-//
 %09%09%09// Sy
@@ -1724,16 +1724,12 @@
 ));%0A
-//
 %09%09%7D%0A
-//
 %09%09cl

Make example work