KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > poi > hssf > record > EndSubRecord


1
2 /* ====================================================================
3    Copyright 2002-2004 Apache Software Foundation
4
5    Licensed under the Apache License, Version 2.0 (the "License");
6    you may not use this file except in compliance with the License.
7    You may obtain a copy of the License at
8
9        http://www.apache.org/licenses/LICENSE-2.0
10
11    Unless required by applicable law or agreed to in writing, software
12    distributed under the License is distributed on an "AS IS" BASIS,
13    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14    See the License for the specific language governing permissions and
15    limitations under the License.
16 ==================================================================== */

17         
18
19
20 package org.apache.poi.hssf.record;
21
22
23
24 import org.apache.poi.util.*;
25
26 /**
27  * The end data record is used to denote the end of the subrecords.
28  * NOTE: This source is automatically generated please do not modify this file. Either subclass or
29  * remove the record in src/records/definitions.
30
31  * @author Glen Stampoultzis (glens at apache.org)
32  */

33 public class EndSubRecord
34     extends SubRecord
35 {
36     public final static short sid = 0x00;
37
38
39     public EndSubRecord()
40     {
41
42     }
43
44     /**
45      * Constructs a End record and sets its fields appropriately.
46      *
47      * @param id id must be 0x00 or an exception
48      * will be throw upon validation
49      * @param size size the size of the data area of the record
50      * @param data data of the record (should not contain sid/len)
51      */

52
53     public EndSubRecord(short id, short size, byte [] data)
54     {
55         super(id, size, data);
56     
57     }
58
59     /**
60      * Constructs a End record and sets its fields appropriately.
61      *
62      * @param id id must be 0x00 or an exception
63      * will be throw upon validation
64      * @param size size the size of the data area of the record
65      * @param data data of the record (should not contain sid/len)
66      * @param offset of the record's data
67      */

68
69     public EndSubRecord(short id, short size, byte [] data, int offset)
70     {
71         super(id, size, data, offset);
72     
73     }
74
75     /**
76      * Checks the sid matches the expected side for this record
77      *
78      * @param id the expected sid.
79      */

80     protected void validateSid(short id)
81     {
82         if (id != sid)
83         {
84             throw new RecordFormatException("Not a End record");
85         }
86     }
87
88     protected void fillFields(byte [] data, short size, int offset)
89     {
90
91         int pos = 0;
92
93     }
94
95     public String JavaDoc toString()
96     {
97         StringBuffer JavaDoc buffer = new StringBuffer JavaDoc();
98
99         buffer.append("[ftEnd]\n");
100
101         buffer.append("[/ftEnd]\n");
102         return buffer.toString();
103     }
104
105     public int serialize(int offset, byte[] data)
106     {
107         int pos = 0;
108
109         LittleEndian.putShort(data, 0 + offset, sid);
110         LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
111
112
113         return getRecordSize();
114     }
115
116     /**
117      * Size of record (exluding 4 byte header)
118      */

119     public int getRecordSize()
120     {
121         return 4 ;
122     }
123
124     public short getSid()
125     {
126         return this.sid;
127     }
128
129     public Object JavaDoc clone() {
130         EndSubRecord rec = new EndSubRecord();
131     
132         return rec;
133     }
134
135
136
137 } // END OF CLASS
138

139
140
Popular Tags