You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by fa...@apache.org on 2022/07/17 09:07:07 UTC
svn commit: r1902802 - /poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/dev/SlideShowDumper.java
Author: fanningpj
Date: Sun Jul 17 09:07:07 2022
New Revision: 1902802
URL: http://svn.apache.org/viewvc?rev=1902802&view=rev
Log:
[github-353] Use printf. Thanks to XenoAmess. This closes #353
Modified:
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/dev/SlideShowDumper.java
Modified: poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/dev/SlideShowDumper.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/dev/SlideShowDumper.java?rev=1902802&r1=1902801&r2=1902802&view=diff
==============================================================================
--- poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/dev/SlideShowDumper.java (original)
+++ poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/dev/SlideShowDumper.java Sun Jul 17 09:07:07 2022
@@ -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) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org