1
2
3
4
5
6
7
8
9
10
11 package it.imolinfo.jbi4cics.connection.jca;
12
13 import it.imolinfo.jbi4cics.jbi.Messages;
14 import java.io.IOException;
15 import java.io.InputStream;
16 import java.io.OutputStream;
17
18 import javax.resource.cci.Record;
19 import javax.resource.cci.Streamable;
20
21
22
23
24
25 public class CommareaRecord implements Streamable, Record {
26
27
28
29
30 private static final long serialVersionUID = -4083607545259706340L;
31
32
33
34
35 private static final Messages MESSAGES
36 = Messages.getMessages(CommareaRecord.class);
37
38
39
40
41 private String recordName;
42 private String recordShortDescription;
43 private byte[] commarea;
44
45
46
47
48 public CommareaRecord() {
49 super();
50
51 }
52
53
54
55
56 public int getCommareaLength() {
57 return commarea.length;
58 }
59
60
61
62
63 public void setCommareaLength(int commareaLength) {
64 commarea=new byte[commareaLength];
65 }
66
67
68
69
70
71
72 public void read(InputStream is) throws IOException {
73 int byteRead=is.read(commarea);
74 if (byteRead!=commarea.length){
75 throw new IOException(MESSAGES.getString("CIC000301_IO_exception", new Object[] {byteRead, commarea.length}));
76 }
77 }
78
79
80
81
82 public void write(OutputStream os) throws IOException {
83 os.write(commarea);
84 }
85
86
87
88
89 public String getRecordName() {
90 return recordName;
91 }
92
93
94
95
96 public void setRecordName(String arg0) {
97 recordName=arg0;
98 }
99
100
101
102
103 public void setRecordShortDescription(String arg0) {
104 recordShortDescription=arg0;
105 }
106
107
108
109
110 public String getRecordShortDescription() {
111 return recordShortDescription;
112 }
113
114
115
116
117 public byte[] getCommarea() {
118 return commarea;
119 }
120
121
122
123
124 public void setCommarea(byte[] commarea) {
125 this.commarea = commarea;
126 }
127
128 public Object clone(){
129 CommareaRecord cloned=new CommareaRecord();
130 cloned.setRecordName(recordName);
131 cloned.setRecordShortDescription(recordShortDescription);
132 byte[] buffer=new byte[commarea.length];
133 System.arraycopy(commarea,0,buffer,0,commarea.length);
134 cloned.setCommarea(buffer);
135 return cloned;
136 }
137
138 }
139
140
141
142
143