Package com.ibm.commons.util.io

Examples of com.ibm.commons.util.io.ByteStreamCache.toByteArray()


      if(object!=null) {
        ByteStreamCache bs = new ByteStreamCache(1024);
        ObjectOutputStream os = new ObjectOutputStream(bs.getOutputStream());
        try {
          os.writeObject(object);
          return bs.toByteArray();
        } finally {
          os.close();
        }
      }
      return null;
View Full Code Here


        entry.setMethod( ZipEntry.DEFLATED );
       
        CRC32 checksumCalculator= new CRC32();
        ByteStreamCache bsc = new ByteStreamCache();
        entry.setSize( StreamUtil.copyStream( is, bsc.getOutputStream() ));
        checksumCalculator.update( bsc.toByteArray() );
        entry.setCrc(checksumCalculator.getValue());
       
        jarOS.putNextEntry( entry );
        //Now that we have the correct size, we can copy it to the jar stream
        StreamUtil.copyStream( bsc.getInputStream(), jarOS );
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.