Merge pull request #290 from AlrikG/ImproveCompressedSerialization

Improve compressed serialization
experimental
Kirill Vainer 10 years ago
commit 9226299a87
  1. 3
      jme3-networking/src/main/java/com/jme3/network/serializing/serializers/GZIPSerializer.java
  2. 3
      jme3-networking/src/main/java/com/jme3/network/serializing/serializers/ZIPSerializer.java

@ -87,7 +87,8 @@ public class GZIPSerializer extends Serializer {
ByteArrayOutputStream byteArrayOutput = new ByteArrayOutputStream();
GZIPOutputStream gzipOutput = new GZIPOutputStream(byteArrayOutput);
gzipOutput.write(tempBuffer.array());
tempBuffer.flip();
gzipOutput.write(tempBuffer.array(), 0, tempBuffer.limit());
gzipOutput.flush();
gzipOutput.finish();
gzipOutput.close();

@ -98,7 +98,8 @@ public class ZIPSerializer extends Serializer {
ZipEntry zipEntry = new ZipEntry("zip");
zipOutput.putNextEntry(zipEntry);
zipOutput.write(tempBuffer.array());
tempBuffer.flip();
zipOutput.write(tempBuffer.array(), 0, tempBuffer.limit());
zipOutput.flush();
zipOutput.closeEntry();
zipOutput.close();

Loading…
Cancel
Save