Use Maven for building yaz4j.
[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         {
17                 this.resultSet = resultSet;
18                 this.record = record;
19         }
20
21         public void finalize()
22         {
23                 Dispose();
24         }
25         
26         public byte[] getContent()
27         {
28                 String type = "raw";
29                 SWIGTYPE_p_int length = null ;  
30                 return yaz4jlib.ZOOM_record_get_bytes(record, type, length) ;
31 //              String contentString = yaz4jlib.ZOOM_record_get(record, type, length) ;
32 //              System.err.println("!!!!!");
33 //              System.err.println(contentString);
34 //              System.err.println(contentString.length());
35 //              System.err.println("!!!!!");
36 //              try {
37 //                      byte[] bytes = contentString.getBytes("UTF8");
38 //                      System.err.println(bytes.length);
39 //                      return bytes ;
40 //              } catch (UnsupportedEncodingException e) {
41 //                      throw new RuntimeException(e);
42 //              }
43         }
44
45         public String getSyntax()
46         {
47                 String type = "syntax";
48                 SWIGTYPE_p_int length = null ;          
49                 String syntax = yaz4jlib.ZOOM_record_get(record, type, length);
50                 return syntax ;
51         }
52         
53         public String getDatabase()
54         {
55                 String type = "database";
56                 SWIGTYPE_p_int length = null ;          
57                 String database = yaz4jlib.ZOOM_record_get(record, type, length);
58         
59                 return database ;
60         }
61
62         public void Dispose()
63         {
64                 if (!disposed)
65                 {
66                         resultSet = null;
67                         record = null;
68                         disposed = true;
69                 }
70         }
71 }