diff options
author | Said Ryan Ackley <sackley@apache.org> | 2002-07-17 12:01:50 +0000 |
---|---|---|
committer | Said Ryan Ackley <sackley@apache.org> | 2002-07-17 12:01:50 +0000 |
commit | da28cafe97c55643c3f8a3b4152cff4b5dd2b71c (patch) | |
tree | 390304b9afe03848cf3f4e3bc2f28d63d634433b | |
parent | 31eeabbe9931bcd8a8fd9c14b4965c22a7db6562 (diff) | |
download | poi-da28cafe97c55643c3f8a3b4152cff4b5dd2b71c.tar.gz poi-da28cafe97c55643c3f8a3b4152cff4b5dd2b71c.zip |
made the read method compile
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352776 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | src/java/org/apache/poi/hpsf/ClassID.java | 53 |
1 files changed, 25 insertions, 28 deletions
diff --git a/src/java/org/apache/poi/hpsf/ClassID.java b/src/java/org/apache/poi/hpsf/ClassID.java index 74069dd09e..b87d775bf1 100644 --- a/src/java/org/apache/poi/hpsf/ClassID.java +++ b/src/java/org/apache/poi/hpsf/ClassID.java @@ -56,6 +56,7 @@ package org.apache.poi.hpsf; import java.io.*; +import org.apache.poi.util.LittleEndian; /** * REWRITE ME @@ -111,34 +112,30 @@ public class ClassID { public byte[] read(byte[] src, int offset) { byte[] retval = new byte[24]; - throw new RuntimeException("This fucntion must be rewritten"); -/* - Object[] b = new Object[11]; - b[0] = new Long(LittleEndian.getUInt(src, offset)); - b[1] = new Integer(LittleEndian.getInt(src, offset += LittleEndian.INT_SIZE)); - b[2] = new Integer(LittleEndian.getInt(src, offset += LittleEndian.INT_SIZE)); - b[3] = new Byte(LittleEndian.getUnsignedByte(src, offset += LittleEndian.INT_SIZE); - b[4] = new Byte(LittleEndian.getUnsignedByte(src, offset += 1)); - b[5] = new Byte(LittleEndian.getUnsignedByte(src, offset += 1)); - b[6] = new Byte(LittleEndian.getUnsignedByte(src, offset += 1)); - b[7] = new Byte(LittleEndian.getUnsignedByte(src, offset += 1)); - b[8] = new Byte(LittleEndian.getUnsignedByte(src, offset += 1)); - b[9] = new Byte(LittleEndian.getUnsignedByte(src, offset += 1)); - b[10] = new Byte(LittleEndian.getUnsignedByte(src, offset += 1)); - int capacity = 24; -// for (int i = 0; i < b.length; i++) { -// capacity += b[i].getBytes().length; -// } - bytes = new byte[capacity]; - int pos = 0; - - for (int i = 0; i < b.length; i++) { - byte[] s = b[i].getBytes(); - for (int j = 0; j < s.length; j++) { - bytes[pos++] = s[j]; - } - } - return bytes;*/ + //throw new RuntimeException("This fucntion must be rewritten"); + + //Number[] b = new Number[11]; + + //b[0] = new Integer(LittleEndian.getInt(src, offset)); + //transfer the first Int from little to big endian + retval[0] = src[3]; + retval[1] = src[2]; + retval[2] = src[1]; + retval[3] = src[0]; + + //b[1] = new Short(LittleEndian.getInt(src, offset += LittleEndian.INT_SIZE)); + //transfer the second short from little to big endian + retval[4] = src[5]; + retval[5] = src[4]; + + //b[2] = new Short(LittleEndian.getInt(src, offset += LittleEndian.SHORT_SIZE)); + //transfer the third short from little to big endian + retval[6] = src[7]; + retval[7] = src[6]; + + System.arraycopy(src, 8, retval, 8, retval.length - 8); + + return retval; } } |