diff options
author | PJ Fanning <fanningpj@apache.org> | 2022-07-17 09:07:07 +0000 |
---|---|---|
committer | PJ Fanning <fanningpj@apache.org> | 2022-07-17 09:07:07 +0000 |
commit | 32069e6f5adab1f19f0571483d9afb562e212389 (patch) | |
tree | 40aaa6ebeb15d8f88b18f36e8b109374bf5ab632 /poi-scratchpad/src | |
parent | 50c40b61f72903693f5304767fdd337d7e685f50 (diff) | |
download | poi-32069e6f5adab1f19f0571483d9afb562e212389.tar.gz poi-32069e6f5adab1f19f0571483d9afb562e212389.zip |
[github-353] Use printf. Thanks to XenoAmess. This closes #353
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1902802 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-scratchpad/src')
-rw-r--r-- | poi-scratchpad/src/main/java/org/apache/poi/hslf/dev/SlideShowDumper.java | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hslf/dev/SlideShowDumper.java b/poi-scratchpad/src/main/java/org/apache/poi/hslf/dev/SlideShowDumper.java index 6f55f394d4..084b15b9c1 100644 --- a/poi-scratchpad/src/main/java/org/apache/poi/hslf/dev/SlideShowDumper.java +++ b/poi-scratchpad/src/main/java/org/apache/poi/hslf/dev/SlideShowDumper.java @@ -17,12 +17,6 @@ package org.apache.poi.hslf.dev; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.PrintStream; -import java.util.Locale; - import org.apache.poi.ddf.DefaultEscherRecordFactory; import org.apache.poi.ddf.EscherContainerRecord; import org.apache.poi.ddf.EscherRecord; @@ -35,6 +29,12 @@ import org.apache.poi.util.HexDump; import org.apache.poi.util.IOUtils; import org.apache.poi.util.LittleEndian; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.PrintStream; +import java.util.Locale; + /** * This class provides a way to "peek" inside a powerpoint file. It * will print out all the types it finds, and for those it knows aren't @@ -185,14 +185,14 @@ public final class SlideShowDumper { byte opt = docstream[pos]; String fmt = ind + "At position %2$d (%2$04x): type is %3$d (%3$04x), len is %4$d (%4$04x)"; - out.println(String.format(Locale.ROOT, fmt, "", pos, type, len)); + out.printf(Locale.ROOT, (fmt) + "%n", "", pos, type, len); // See if we know about the type of it String recordName = RecordTypes.forTypeID((short) type).name(); // Jump over header, and think about going on more pos += 8; - out.println(String.format(Locale.ROOT, ind + "That's a %2$s", "", recordName)); + out.printf(Locale.ROOT, ind + "That's a %2$s%n", "", recordName); // Now check if it's a container or not int container = opt & 0x0f; @@ -247,17 +247,17 @@ public final class SlideShowDumper { int recordLen = record.getRecordSize(); String fmt = ind + "At position %2$d (%2$04x): type is %3$d (%3$04x), len is %4$d (%4$04x) (%5$d) - record claims %6$d"; - out.println(String.format(Locale.ROOT, fmt, "", pos, atomType, atomLen, atomLen + 8, recordLen)); + out.printf(Locale.ROOT, (fmt) + "%n", "", pos, atomType, atomLen, atomLen + 8, recordLen); // Check for corrupt / lying ones if (recordLen != 8 && (recordLen != (atomLen + 8))) { - out.println(String.format(Locale.ROOT, ind + "** Atom length of $2d ($3d) doesn't match record length of %4d", "", atomLen, atomLen + 8, recordLen)); + out.printf(Locale.ROOT, ind + "** Atom length of $2d ($3d) doesn't match record length of %4d%n", "", atomLen, atomLen + 8, recordLen); } // Print the record's details String recordStr = record.toString().replace("\n", String.format(Locale.ROOT, "\n" + ind, "")); - out.println(String.format(Locale.ROOT, ind + "%2$s", "", recordStr)); + out.printf(Locale.ROOT, ind + "%2$s%n", "", recordStr); if (record instanceof EscherContainerRecord) { walkEscherDDF((indent + 3), pos + 8, (int) atomLen); @@ -273,7 +273,7 @@ public final class SlideShowDumper { recordLen = (int) atomLen + 8; record.fillFields(contents, 0, erf); if (!(record instanceof EscherTextboxRecord)) { - out.println(String.format(Locale.ROOT, ind + "%2$s", "", "** Really a msofbtClientTextbox !")); + out.printf(Locale.ROOT, ind + "%2$s%n", "", "** Really a msofbtClientTextbox !"); } } @@ -315,10 +315,10 @@ public final class SlideShowDumper { long atomlen = LittleEndian.getUInt(docstream, pos + 4); String fmt = ind + "At position %2$d ($2$04x): type is %3$d (%3$04x), len is %4$d (%4$04x)"; - out.println(String.format(Locale.ROOT, fmt, "", pos, type, atomlen)); + out.printf(Locale.ROOT, (fmt) + "%n", "", pos, type, atomlen); String typeName = RecordTypes.forTypeID((short) type).name(); - out.println(String.format(Locale.ROOT, ind + "%2$s", "That's an Escher Record: ", typeName)); + out.printf(Locale.ROOT, ind + "%2$s%n", "That's an Escher Record: ", typeName); // Record specific dumps if (type == 61453L) { |