git://git.nikiroo.be
/
fanfix.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
50f3107
)
serial/Exporter: Better zip/noZip choice
author
Niki Roo
<niki@nikiroo.be>
Sun, 24 Feb 2019 09:46:08 +0000
(10:46 +0100)
committer
Niki Roo
<niki@nikiroo.be>
Sun, 24 Feb 2019 09:46:08 +0000
(10:46 +0100)
src/be/nikiroo/utils/serial/Exporter.java
patch
|
blob
|
blame
|
history
diff --git
a/src/be/nikiroo/utils/serial/Exporter.java
b/src/be/nikiroo/utils/serial/Exporter.java
index 90939880f6f29e0e2ba1488f274db1daed932f7b..3a6e025739c9faf0893fa2a65f07970012ae8f0e 100644
(file)
--- a/
src/be/nikiroo/utils/serial/Exporter.java
+++ b/
src/be/nikiroo/utils/serial/Exporter.java
@@
-59,18
+59,21
@@
public class Exporter {
* The exported items in a serialised form.
*
* @param zip
* The exported items in a serialised form.
*
* @param zip
- * TRUE to have zipped
content, FALSE to have raw content, NULL
- * to let the system decide
+ * TRUE to have zipped
(and BASE64-coded) content, FALSE to have
+ *
raw content, NULL
to let the system decide
*
* @return the items currently in this {@link Exporter}
*/
public String toString(Boolean zip) {
*
* @return the items currently in this {@link Exporter}
*/
public String toString(Boolean zip) {
- if (zip == null) {
- zip =
builder.length() > 128
;
+ if (zip == null
&& builder.length() > 128
) {
+ zip =
false
;
}
}
- if (zip) {
- return "ZIP:" + StringUtils.zip64(builder.toString());
+ if (zip == null || zip) {
+ String zipped = "ZIP:" + StringUtils.zip64(builder.toString());
+
+ if (zip != null || builder.length() < zipped.length())
+ return zipped;
}
return builder.toString();
}
return builder.toString();