From de4a30d2bb2ca05ab5df08e9042353c56f49f76d Mon Sep 17 00:00:00 2001 From: Sergey Vladimirov Date: Tue, 5 Jul 2011 00:46:42 +0000 Subject: [PATCH] add SprmOperation.toString() for debug purposes git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1142859 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/poi/hwpf/sprm/SprmOperation.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmOperation.java b/src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmOperation.java index fedf98e9ab..836d93617a 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmOperation.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmOperation.java @@ -40,6 +40,7 @@ public final class SprmOperation final static public int PAP_TYPE = 1; final static public int TAP_TYPE = 5; + private short _value; private int _type; private int _operation; private int _gOffset; @@ -51,14 +52,14 @@ public final class SprmOperation { _grpprl = grpprl; - short sprmStart = LittleEndian.getShort(grpprl, offset); + _value = LittleEndian.getShort(grpprl, offset); _gOffset = offset + 2; - _operation = OP_BITFIELD.getValue(sprmStart); - _type = TYPE_BITFIELD.getValue(sprmStart); - _sizeCode = SIZECODE_BITFIELD.getValue(sprmStart); - _size = initSize(sprmStart); + _operation = OP_BITFIELD.getValue(_value); + _type = TYPE_BITFIELD.getValue(_value); + _sizeCode = SIZECODE_BITFIELD.getValue(_value); + _size = initSize(_value); } public static int getOperationFromOpcode(short opcode) @@ -159,4 +160,10 @@ public final class SprmOperation throw new IllegalArgumentException("SPRM contains an invalid size code"); } } + + @Override + public String toString() + { + return "[SPRM] (0x" + Integer.toHexString( _value & 0xffff ) + ")"; + } } -- 2.39.5