Changeset 83 for trunk/src/main/java/omq/common/util/Zipper.java
- Timestamp:
- 07/08/13 13:29:24 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/main/java/omq/common/util/Zipper.java
r44 r83 7 7 import java.util.zip.GZIPOutputStream; 8 8 9 /** 10 * This class enables the compression of the information sent through the 11 * rabbitmq server. 12 * 13 * @author Sergi Toda <sergi.toda@estudiants.urv.cat> 14 * 15 */ 9 16 public class Zipper { 10 17 … … 16 23 zos = new GZIPOutputStream(baos); 17 24 zos.write(b); 18 } finally {19 if (zos != null){25 } finally { 26 if (zos != null) { 20 27 zos.close(); 21 28 } 22 29 23 30 baos.close(); 24 31 } 25 32 26 33 return baos.toByteArray(); 27 34 } … … 34 41 try { 35 42 zis = new GZIPInputStream(bais); 36 43 37 44 byte[] tmpBuffer = new byte[256]; 38 45 int n; … … 40 47 baos.write(tmpBuffer, 0, n); 41 48 } 42 } finally { 43 if (zis != null){49 } finally { 50 if (zis != null) { 44 51 zis.close(); 45 52 } 46 53 47 54 bais.close(); 48 55 baos.close(); 49 } 50 56 } 57 51 58 return baos.toByteArray(); 52 } 59 } 53 60 }
Note: See TracChangeset
for help on using the changeset viewer.