import be.nikiroo.utils.CryptUtils;
import be.nikiroo.utils.IOUtils;
+import be.nikiroo.utils.StringUtils;
import be.nikiroo.utils.serial.Exporter;
import be.nikiroo.utils.serial.Importer;
import be.nikiroo.utils.streams.BufferedOutputStream;
try {
if (asString) {
- sub.write(data.toString().getBytes("UTF-8"));
+ sub.write(StringUtils.getBytes(data.toString()));
} else {
new Exporter(sub).append(data);
}
* @throws java.lang.NullPointerException
* for Objects only: if the counter part has no data to send
*/
+ @SuppressWarnings("resource")
private Object rec(boolean asString) throws IOException,
NoSuchFieldException, NoSuchMethodException,
ClassNotFoundException, java.lang.NullPointerException {
contentToSend = false;
}
- if (in.next()) {
+ if (in.next() && !in.eof()) {
// TODO: could be possible to check for non-crypt and only
// do it for crypt
InputStream read = new ReplaceInputStream(in.open(), //