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;
synchronized (lock) {
OutputStream sub;
if (crypt != null) {
- sub = crypt.encrypt64(out.open(), false);
+ sub = crypt.encrypt64(out.open());
} else {
sub = out.open();
}
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(), //
try {
if (crypt != null) {
- read = crypt.decrypt64(read, false);
+ read = crypt.decrypt64(read);
}
if (asString) {