KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jxl > read > biff > FooterRecord


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.read.biff;
21
22 import jxl.WorkbookSettings;
23 import jxl.biff.StringHelper;
24 import jxl.biff.IntegerHelper;
25 import jxl.biff.RecordData;
26
27 /**
28  * A workbook page footer record
29  */

30 public class FooterRecord extends RecordData
31 {
32   /**
33    * The footer
34    */

35   private String JavaDoc footer;
36
37   /**
38    * Dummy indicators for overloading the constructor
39    */

40   private static class Biff7 {};
41   public static Biff7 biff7 = new Biff7();
42
43   /**
44    * Constructs this object from the raw data
45    *
46    * @param t the record data
47    * @param ws the workbook settings
48    */

49   FooterRecord(Record t, WorkbookSettings ws)
50   {
51     super(t);
52     byte[] data = getRecord().getData();
53
54     if (data.length == 0)
55     {
56       return;
57     }
58
59     int chars = IntegerHelper.getInt(data[0], data[1]);
60
61     boolean unicode = data[2] == 1;
62
63     if (unicode)
64     {
65       footer = StringHelper.getUnicodeString(data, chars, 3);
66     }
67     else
68     {
69       footer = StringHelper.getString(data, chars, 3, ws);
70     }
71   }
72
73   /**
74    * Constructs this object from the raw data
75    *
76    * @param t the record data
77    * @param ws the workbook settings
78    * @param dummy dummy record to indicate a biff7 document
79    */

80   FooterRecord(Record t, WorkbookSettings ws, Biff7 dummy)
81   {
82     super(t);
83     byte[] data = getRecord().getData();
84
85     if (data.length == 0)
86     {
87       return;
88     }
89
90     int chars = data[0];
91     footer = StringHelper.getString(data, chars, 1, ws);
92   }
93
94   /**
95    * Gets the footer string
96    *
97    * @return the footer string
98    */

99   String JavaDoc getFooter()
100   {
101     return footer;
102   }
103 }
104
Popular Tags