aboutsummaryrefslogtreecommitdiffstats
path: root/src/contrib
diff options
context:
space:
mode:
authorRainer Klute <klute@apache.org>2003-02-22 13:39:24 +0000
committerRainer Klute <klute@apache.org>2003-02-22 13:39:24 +0000
commit3948949f07578dc17e621f11c7ab5cc4f519d368 (patch)
tree5ed547bb4dbc7925829c26da6652ae81b9a100a9 /src/contrib
parent3c9fa7d28c27b3c2dbe25d292dac19525c06afce (diff)
downloadpoi-3948949f07578dc17e621f11c7ab5cc4f519d368.tar.gz
poi-3948949f07578dc17e621f11c7ab5cc4f519d368.zip
Small bug fixes with respect to hex decoding.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353012 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/contrib')
-rw-r--r--src/contrib/src/org/apache/poi/contrib/poibrowser/Codec.java20
-rw-r--r--src/contrib/src/org/apache/poi/contrib/poibrowser/POIBrowser.java2
-rw-r--r--src/contrib/src/org/apache/poi/contrib/poibrowser/PropertySetDescriptorRenderer.java4
3 files changed, 21 insertions, 5 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 9b7d21ca0f..325b0fe077 100644
--- a/src/contrib/src/org/apache/poi/contrib/poibrowser/Codec.java
+++ b/src/contrib/src/org/apache/poi/contrib/poibrowser/Codec.java
@@ -143,6 +143,22 @@ public class Codec
/**
+ * <p>Converts a short value (16-bit) into its hexadecimal
+ * notation.</p>
+ */
+ public static String hexEncode(final short s)
+ {
+ StringBuffer sb = new StringBuffer(4);
+ sb.append((char) hexval[(s & 0xF000) >> 12]);
+ sb.append((char) hexval[(s & 0x0F00) >> 8]);
+ sb.append((char) hexval[(s & 0x00F0) >> 4]);
+ sb.append((char) hexval[(s & 0x000F) >> 0]);
+ return sb.toString();
+ }
+
+
+
+ /**
* <p>Converts an int value (32-bit) into its hexadecimal
* notation.</p>
*/
@@ -169,8 +185,8 @@ public class Codec
public static String hexEncode(final long l)
{
StringBuffer sb = new StringBuffer(16);
- sb.append((l & 0xFFFFFFFF00000000L) >> 32);
- sb.append((l & 0x00000000FFFFFFFFL) >> 0);
+ sb.append(hexEncode((int) (l & 0xFFFFFFFF00000000L) >> 32));
+ sb.append(hexEncode((int) (l & 0x00000000FFFFFFFFL) >> 0));
return sb.toString();
}
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 5e1cb1394a..1ca8d8342c 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.07");
+ setTitle("POI Browser 0.08");
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 bb2750ab2f..a425c1372a 100644
--- a/src/contrib/src/org/apache/poi/contrib/poibrowser/PropertySetDescriptorRenderer.java
+++ b/src/contrib/src/org/apache/poi/contrib/poibrowser/PropertySetDescriptorRenderer.java
@@ -94,9 +94,9 @@ public class PropertySetDescriptorRenderer extends DocumentDescriptorRenderer
text.setFont(new Font("Monospaced", Font.PLAIN, 10));
text.append(renderAsString(d));
text.append("\nByte order: " +
- Codec.hexEncode(ps.getByteOrder()));
+ Codec.hexEncode((short) ps.getByteOrder()));
text.append("\nFormat: " +
- Codec.hexEncode(ps.getFormat()));
+ Codec.hexEncode((short) ps.getFormat()));
text.append("\nOS version: " +
Codec.hexEncode(ps.getOSVersion()));
text.append("\nClass ID: " +