KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jxl > write > biff > BOFRecord


1 /*********************************************************************
2 *
3 * Copyright (C) 2002 Andrew Khan
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 ***************************************************************************/

19
20 package jxl.write.biff;
21
22 import jxl.biff.Type;
23 import jxl.biff.WritableRecordData;
24
25 /**
26  * Record to indicate the beginning of a new stream in the Compound
27  * File
28  */

29 class BOFRecord extends WritableRecordData
30 {
31   /**
32    * The data to write to the file
33    */

34   private byte[] data;
35
36   // Dummy types for constructor overloading
37
private static class WorkbookGlobalsBOF{};
38   private static class SheetBOF{};
39
40   public final static WorkbookGlobalsBOF workbookGlobals
41     = new WorkbookGlobalsBOF();
42   public final static SheetBOF sheet = new SheetBOF();
43
44   /**
45    * Constructor for generating a workbook globals BOF record
46    *
47    * @param dummy - a dummy argument for overloading purposes
48    */

49   public BOFRecord(WorkbookGlobalsBOF dummy)
50   {
51     super(Type.BOF);
52
53     // Create the data as biff 8 format with a substream type of
54
// workbook globals
55
data = new byte[]
56     {(byte) 0x0,
57      (byte) 0x6,
58      (byte) 0x5, // substream type
59
(byte) 0x0, // substream type
60
(byte) 0xf2, // rupBuild
61
(byte) 0x15, // rupBuild
62
(byte) 0xcc, // rupYear
63
(byte) 0x07, // rupYear
64
(byte) 0x0, // bfh
65
(byte) 0x0, // bfh
66
(byte) 0x0, // bfh
67
(byte) 0x0, // bfh
68
(byte) 0x6, // sfo
69
(byte) 0x0, // sfo,
70
(byte) 0x0, // sfo
71
(byte) 0x0 // sfo
72
};
73   }
74
75   /**
76    * Constructor for generating a sheet BOF record
77    *
78    * @param dummy - a dummy argument for overloading purposes
79    */

80   public BOFRecord(SheetBOF dummy)
81   {
82     super(Type.BOF);
83
84     // Create the data as biff 8 format with a substream type of
85
// worksheet
86
data = new byte[]
87     {(byte) 0x0,
88      (byte) 0x6,
89      (byte) 0x10, // substream type
90
(byte) 0x0, // substream type
91
(byte) 0xf2, // rupBuild
92
(byte) 0x15, // rupBuild
93
(byte) 0xcc, // rupYear
94
(byte) 0x07, // rupYear
95
(byte) 0x0, // bfh
96
(byte) 0x0, // bfh
97
(byte) 0x0, // bfh
98
(byte) 0x0, // bfh
99
(byte) 0x6, // sfo
100
(byte) 0x0, // sfo,
101
(byte) 0x0, // sfo
102
(byte) 0x0 // sfo
103
};
104   }
105
106   /**
107    * Gets the data for writing to the output file
108    *
109    * @return the binary data for writing
110    */

111   public byte[] getData()
112   {
113     return data;
114   }
115 }
116
117
Popular Tags