X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fyaz4j%2FRecord.java;h=50fa38181d808c760666a40fbd64ec09ac0e987d;hb=51cc88d374e72f4c93a4721c2094e028a6ffae85;hp=e1990a700252db3c7c1301b355a5fb9debacedc2;hpb=428d895d6dc31b784e953ea935d662cfc4a4bd43;p=yaz4j-moved-to-github.git diff --git a/src/main/java/org/yaz4j/Record.java b/src/main/java/org/yaz4j/Record.java index e1990a7..50fa381 100644 --- a/src/main/java/org/yaz4j/Record.java +++ b/src/main/java/org/yaz4j/Record.java @@ -1,71 +1,50 @@ package org.yaz4j; -import java.io.UnsupportedEncodingException; - import org.yaz4j.jni.SWIGTYPE_p_ZOOM_record_p; import org.yaz4j.jni.SWIGTYPE_p_int; import org.yaz4j.jni.yaz4jlib; -public class Record -{ - private SWIGTYPE_p_ZOOM_record_p record = null ; - private ResultSet resultSet = null ; - private boolean disposed = false; +public class Record { + + private SWIGTYPE_p_ZOOM_record_p record = null; + private ResultSet resultSet = null; + private boolean disposed = false; + + Record(SWIGTYPE_p_ZOOM_record_p record, ResultSet resultSet) { + this.resultSet = resultSet; + this.record = record; + } + + public void finalize() { + _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")); + } - Record(SWIGTYPE_p_ZOOM_record_p record, ResultSet resultSet) - { - this.resultSet = resultSet; - this.record = record; - } + public byte[] getContent() { + return get("raw"); + } - public void finalize() - { - Dispose(); - } - - 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); -// } - } + public String getSyntax() { + return new String(get("syntax")); + } - public String getSyntax() - { - String type = "syntax"; - SWIGTYPE_p_int length = null ; - String syntax = yaz4jlib.ZOOM_record_get(record, type, length); - return syntax ; - } - - public String getDatabase() - { - String type = "database"; - SWIGTYPE_p_int length = null ; - String database = yaz4jlib.ZOOM_record_get(record, type, length); - - return database ; - } + public String getDatabase() { + return new String(get("database")); + } - public void Dispose() - { - if (!disposed) - { - resultSet = null; - record = null; - disposed = true; - } - } + void _dispose() { + if (!disposed) { + resultSet = null; + record = null; + disposed = true; + } + } }