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