1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 package org.openoffice.xmerge.converter.xml.sxc.pexcel.records; 25 26 import java.io.OutputStream; 27 import java.io.InputStream; 28 import java.io.IOException; 29 30 import org.openoffice.xmerge.util.Debug; 31 import org.openoffice.xmerge.util.EndianConverter; 32 import org.openoffice.xmerge.converter.xml.sxc.pexcel.PocketExcelConstants; 33 34 /** 35 * Represents a BIFF record defiuning the default row height 36 */ 37 public class DefRowHeight implements BIFFRecord { 38 39 private byte[] unknown1 = new byte[2]; 40 private byte[] unknown2 = new byte[2]; 41 DefRowHeight()42 public DefRowHeight() { 43 unknown1 = new byte[] {(byte)0x00, (byte)0x00}; 44 unknown2 = new byte[] {(byte)0xFF, (byte)0x00}; 45 } 46 47 /** 48 * Constructs a DefRowHeight from the <code>InputStream</code> 49 * 50 * @param is InputStream containing a Pocket Excel Data file. 51 */ DefRowHeight(InputStream is)52 public DefRowHeight(InputStream is) throws IOException { 53 read(is); 54 } 55 56 /** 57 * Get the hex code for this particular <code>BIFFRecord</code> 58 * 59 * @return the hex code for <code>DefRowHeight</code> 60 */ getBiffType()61 public short getBiffType() { 62 return PocketExcelConstants.DEFAULT_ROW_HEIGHT; 63 } 64 read(InputStream input)65 public int read(InputStream input) throws IOException { 66 67 int numOfBytesRead = input.read(unknown1); 68 numOfBytesRead += input.read(unknown2); 69 70 Debug.log(Debug.TRACE,"\tunknown1 : "+ EndianConverter.readShort(unknown1) + 71 " unknown2 : " + EndianConverter.readShort(unknown2)); 72 return numOfBytesRead; 73 } 74 write(OutputStream output)75 public void write(OutputStream output) throws IOException { 76 77 output.write(getBiffType()); 78 output.write(unknown1); 79 output.write(unknown2); 80 81 Debug.log(Debug.TRACE,"Writing DefRowHeight record"); 82 83 84 } 85 86 } 87