From 94ae08701bbd7585a0b7e5a92d1975965a503c03 Mon Sep 17 00:00:00 2001 From: Dennis Kao <ulysseskao@gmail.com> Date: Wed, 15 Jan 2014 11:28:52 +0800 Subject: [PATCH] Merge branch 'origin/2.1.x' --- xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/ByteArrayCompressor.java | 34 +++++++++++----------------------- 1 files changed, 11 insertions(+), 23 deletions(-) diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/ByteArrayCompressor.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/ByteArrayCompressor.java index f22eaec..22e1be5 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/ByteArrayCompressor.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/ByteArrayCompressor.java @@ -12,13 +12,10 @@ * ByteArrayCompressor * User: Ulysses * Date: 2007/6/15 - * Time: �U�� 02:21:00 * To change this template use File | Settings | File Templates. */ -public final class ByteArrayCompressor -{ - public static byte[] decompressByteArray(byte[] raw) - { +public final class ByteArrayCompressor { + public static byte[] decompressByteArray(byte[] raw) { // Create the decompressor and give it the data to compress Inflater decompressor = new Inflater(); @@ -30,23 +27,18 @@ // Decompress the data byte[] buf = new byte[1024]; - while (!decompressor.finished()) - { - try - { + while (!decompressor.finished()) { + try { int count = decompressor.inflate(buf); bos.write(buf, 0, count); - } catch (DataFormatException e) - { + } catch (DataFormatException e) { } } - try - { + try { bos.close(); - } catch (IOException e) - { + } catch (IOException e) { } // Get the decompressed data @@ -55,8 +47,7 @@ return decompressedData; } - public static byte[] compressByteArray(byte[] raw) - { + public static byte[] compressByteArray(byte[] raw) { // Create the compressor with highest level of compression Deflater compressor = new Deflater(); @@ -75,18 +66,15 @@ // Compress the data byte[] buf = new byte[1024]; - while (!compressor.finished()) - { + while (!compressor.finished()) { int count = compressor.deflate(buf); bos.write(buf, 0, count); } - try - { + try { bos.close(); - } catch (IOException e) - { + } catch (IOException e) { } // Get the compressed data -- Gitblit v0.0.0-SNAPSHOT