diff options
author | Rainer Klute <klute@apache.org> | 2002-07-17 16:23:22 +0000 |
---|---|---|
committer | Rainer Klute <klute@apache.org> | 2002-07-17 16:23:22 +0000 |
commit | b509a3fe4c9644b591f289d8961e3b34fdc63a4a (patch) | |
tree | e0681a5c824d12b251a6a65d856a85354259100c /src/contrib | |
parent | 3b73e4f21c66f4a713a88fb2867396f1ac63427a (diff) | |
download | poi-b509a3fe4c9644b591f289d8961e3b34fdc63a4a.tar.gz poi-b509a3fe4c9644b591f289d8961e3b34fdc63a4a.zip |
Broken HPSF usage of POI's general little-endian classes fixed.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352778 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/contrib')
3 files changed, 49 insertions, 12 deletions
diff --git a/src/contrib/src/org/apache/poi/contrib/poibrowser/Codec.java b/src/contrib/src/org/apache/poi/contrib/poibrowser/Codec.java index 637eed256f..9b7d21ca0f 100644 --- a/src/contrib/src/org/apache/poi/contrib/poibrowser/Codec.java +++ b/src/contrib/src/org/apache/poi/contrib/poibrowser/Codec.java @@ -60,6 +60,7 @@ package org.apache.poi.contrib.poibrowser; import java.io.*; import java.util.*; +import org.apache.poi.hpsf.ClassID; @@ -142,6 +143,50 @@ public class Codec /** + * <p>Converts an int value (32-bit) into its hexadecimal + * notation.</p> + */ + public static String hexEncode(final int i) + { + StringBuffer sb = new StringBuffer(8); + sb.append((char) hexval[(i & 0xF0000000) >> 28]); + sb.append((char) hexval[(i & 0x0F000000) >> 24]); + sb.append((char) hexval[(i & 0x00F00000) >> 20]); + sb.append((char) hexval[(i & 0x000F0000) >> 16]); + sb.append((char) hexval[(i & 0x0000F000) >> 12]); + sb.append((char) hexval[(i & 0x00000F00) >> 8]); + sb.append((char) hexval[(i & 0x000000F0) >> 4]); + sb.append((char) hexval[(i & 0x0000000F) >> 0]); + return sb.toString(); + } + + + + /** + * <p>Converts a long value (64-bit) into its hexadecimal + * notation.</p> + */ + public static String hexEncode(final long l) + { + StringBuffer sb = new StringBuffer(16); + sb.append((l & 0xFFFFFFFF00000000L) >> 32); + sb.append((l & 0x00000000FFFFFFFFL) >> 0); + return sb.toString(); + } + + + + /** + * <p>Converts a class ID into its hexadecimal notation.</p> + */ + public static String hexEncode(final ClassID classID) + { + return hexEncode(classID.getBytes()); + } + + + + /** * <p>Decodes the hexadecimal representation of a sequence of * bytes into a byte array. Each character in the string * represents a nibble (half byte) and must be one of the diff --git a/src/contrib/src/org/apache/poi/contrib/poibrowser/POIBrowser.java b/src/contrib/src/org/apache/poi/contrib/poibrowser/POIBrowser.java index 90ccf3c694..5e1cb1394a 100644 --- a/src/contrib/src/org/apache/poi/contrib/poibrowser/POIBrowser.java +++ b/src/contrib/src/org/apache/poi/contrib/poibrowser/POIBrowser.java @@ -159,7 +159,7 @@ public class POIBrowser extends JFrame new PropertySetDescriptorRenderer()); treeUI.setCellRenderer(etcr); setSize(600, 450); - setTitle("POI Browser 0.06"); + setTitle("POI Browser 0.07"); setVisible(true); } diff --git a/src/contrib/src/org/apache/poi/contrib/poibrowser/PropertySetDescriptorRenderer.java b/src/contrib/src/org/apache/poi/contrib/poibrowser/PropertySetDescriptorRenderer.java index 522fa061a2..bb2750ab2f 100644 --- a/src/contrib/src/org/apache/poi/contrib/poibrowser/PropertySetDescriptorRenderer.java +++ b/src/contrib/src/org/apache/poi/contrib/poibrowser/PropertySetDescriptorRenderer.java @@ -85,9 +85,6 @@ public class PropertySetDescriptorRenderer extends DocumentDescriptorRenderer final int row, final boolean hasFocus) { - - throw new RuntimeException("THIS FUNCTION BROKEN -- FIX IT"); -/* final PropertySetDescriptor d = (PropertySetDescriptor) ((DefaultMutableTreeNode) value).getUserObject(); final PropertySet ps = d.getPropertySet(); @@ -110,9 +107,8 @@ public class PropertySetDescriptorRenderer extends DocumentDescriptorRenderer if (ps instanceof SummaryInformation) { -*/ /* Use the convenience methods. */ -/* final SummaryInformation si = (SummaryInformation) ps; + final SummaryInformation si = (SummaryInformation) ps; text.append("\n"); text.append("\nTitle: " + si.getTitle()); text.append("\nSubject: " + si.getSubject()); @@ -136,7 +132,7 @@ public class PropertySetDescriptorRenderer extends DocumentDescriptorRenderer if (selected) Util.invert(text); - return p;*/ + return p; } @@ -164,12 +160,9 @@ public class PropertySetDescriptorRenderer extends DocumentDescriptorRenderer */ protected String toString(final Section s, final String name) { - - throw new RuntimeException("THIS FUNCTION BROKEN -- FIX IT"); -/* final StringBuffer b = new StringBuffer(); b.append("\n" + name + " Format ID: "); - b.append(Integer.toHexString(s.getFormatID())); + b.append(Codec.hexEncode(s.getFormatID())); b.append("\n" + name + " Offset: " + s.getOffset()); b.append("\n" + name + " Section size: " + s.getSize()); b.append("\n" + name + " Property count: " + s.getPropertyCount()); @@ -195,7 +188,6 @@ public class PropertySetDescriptorRenderer extends DocumentDescriptorRenderer b.append(value.toString()); } return b.toString(); -*/ } } |