Reformat (NetBeans).
[yaz4j-moved-to-github.git] / src / main / java / org / yaz4j / Record.java
1 package org.yaz4j;
2
3 import java.io.UnsupportedEncodingException;
4
5 import org.yaz4j.jni.SWIGTYPE_p_ZOOM_record_p;
6 import org.yaz4j.jni.SWIGTYPE_p_int;
7 import org.yaz4j.jni.yaz4jlib;
8
9 public class Record {
10
11     private SWIGTYPE_p_ZOOM_record_p record = null;
12     private ResultSet resultSet = null;
13     private boolean disposed = false;
14
15     Record(SWIGTYPE_p_ZOOM_record_p record, ResultSet resultSet) {
16         this.resultSet = resultSet;
17         this.record = record;
18     }
19
20     public void finalize() {
21         Dispose();
22     }
23
24     public byte[] get(String type) {
25         SWIGTYPE_p_int length = null;
26         return yaz4jlib.ZOOM_record_get_bytes(record, type, length);
27     }
28
29     public String render() {
30         return new String(get("render"));
31     }
32
33     public byte[] getContent() {
34         return get("raw");
35     }
36
37     public String getSyntax() {
38         return new String(get("syntax"));
39     }
40
41     public String getDatabase() {
42         return new String(get("database"));
43     }
44
45     public void Dispose() {
46         if (!disposed) {
47             resultSet = null;
48             record = null;
49             disposed = true;
50         }
51     }
52 }