From: Adam Dickmeiss Date: Tue, 22 Sep 2009 13:19:39 +0000 (+0200) Subject: Add Record.{get,render} X-Git-Tag: v1.0~3 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=97881ac893d6e788d29ac899a7a7c0bbd459971f;p=yaz4j-moved-to-github.git Add Record.{get,render} --- diff --git a/src/main/java/org/yaz4j/Record.java b/src/main/java/org/yaz4j/Record.java index e1990a7..830f4d7 100644 --- a/src/main/java/org/yaz4j/Record.java +++ b/src/main/java/org/yaz4j/Record.java @@ -22,41 +22,31 @@ public class Record { Dispose(); } - + + public byte[] get(String type) + { + SWIGTYPE_p_int length = null ; + return yaz4jlib.ZOOM_record_get_bytes(record, type, length) ; + } + + public String render() + { + return new String(get("render")); + } + public byte[] getContent() { - String type = "raw"; - SWIGTYPE_p_int length = null ; - return yaz4jlib.ZOOM_record_get_bytes(record, type, length) ; -// String contentString = yaz4jlib.ZOOM_record_get(record, type, length) ; -// System.err.println("!!!!!"); -// System.err.println(contentString); -// System.err.println(contentString.length()); -// System.err.println("!!!!!"); -// try { -// byte[] bytes = contentString.getBytes("UTF8"); -// System.err.println(bytes.length); -// return bytes ; -// } catch (UnsupportedEncodingException e) { -// throw new RuntimeException(e); -// } + return get("raw"); } public String getSyntax() { - String type = "syntax"; - SWIGTYPE_p_int length = null ; - String syntax = yaz4jlib.ZOOM_record_get(record, type, length); - return syntax ; + return new String(get("syntax")); } public String getDatabase() { - String type = "database"; - SWIGTYPE_p_int length = null ; - String database = yaz4jlib.ZOOM_record_get(record, type, length); - - return database ; + return new String(get("database")); } public void Dispose()