1 23 24 package org.continuent.sequoia.common.stream; 25 26 import java.io.ByteArrayOutputStream ; 27 import java.io.IOException ; 28 import java.io.ObjectOutputStream ; 29 import java.nio.charset.Charset ; 30 31 37 public class DriverStream 38 { 39 40 41 static final int STRING_CHUNK_SIZE = 64000/3; 42 43 static final Charset UTF8Codec = Charset.forName("UTF-8"); 44 45 52 public static final int countBytes(Object obj) throws IOException 53 { 54 ByteArrayOutputStream bos = new ByteArrayOutputStream (); 55 ObjectOutputStream oos = new ObjectOutputStream (bos); 56 oos.writeObject(obj); 57 oos.flush(); 58 oos.close(); 59 bos.close(); 60 return bos.size(); 61 } 62 63 } | Popular Tags |