git://git.nikiroo.be
/
nikiroo-utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' into streamify
[nikiroo-utils.git]
/
src
/
be
/
nikiroo
/
utils
/
serial
/
SerialUtils.java
diff --git
a/src/be/nikiroo/utils/serial/SerialUtils.java
b/src/be/nikiroo/utils/serial/SerialUtils.java
index e2d8decea64113bfe76ac0962196e325a2fcf2d8..e88337b0a7f68ac03fd10ce2696909bb0cf8a187 100644
(file)
--- a/
src/be/nikiroo/utils/serial/SerialUtils.java
+++ b/
src/be/nikiroo/utils/serial/SerialUtils.java
@@
-56,39
+56,42
@@
public class SerialUtils {
// Array types:
customTypes.put("[]", new CustomSerializer() {
@Override
// Array types:
customTypes.put("[]", new CustomSerializer() {
@Override
- protected String toString(Object value) {
+ protected void toStream(OutputStream out, Object value)
+ throws IOException {
String type = value.getClass().getCanonicalName();
type = type.substring(0, type.length() - 2); // remove the []
String type = value.getClass().getCanonicalName();
type = type.substring(0, type.length() - 2); // remove the []
-
StringBuilder builder = new StringBuilder(
);
-
builder.append(type).append(
"\n");
+
write(out,type
);
+
write(out,
"\n");
try {
for (int i = 0; true; i++) {
Object item = Array.get(value, i);
// encode it normally if direct value
try {
for (int i = 0; true; i++) {
Object item = Array.get(value, i);
// encode it normally if direct value
- if (!SerialUtils.encode(
builder
, item)) {
+ if (!SerialUtils.encode(
out
, item)) {
try {
try {
- // use ZIP: if not
- new Exporter().append(item).appendTo(builder,
- true, false);
+ // TODO: use ZIP: if not?
+ new Exporter(out).append(item);
} catch (NotSerializableException e) {
throw new UnknownFormatConversionException(e
.getMessage());
}
}
} catch (NotSerializableException e) {
throw new UnknownFormatConversionException(e
.getMessage());
}
}
-
builder.append(
"\n");
+
write(out,
"\n");
}
} catch (ArrayIndexOutOfBoundsException e) {
// Done.
}
}
} catch (ArrayIndexOutOfBoundsException e) {
// Done.
}
-
- return builder.toString();
}
@Override
protected String getType() {
return "[]";
}
}
@Override
protected String getType() {
return "[]";
}
+
+ @Override
+ protected Object fromStream(InputStream in) throws IOException {
+ return null;
+ }
@Override
protected Object fromString(String content) throws IOException {
@Override
protected Object fromString(String content) throws IOException {