1 48 49 package com.caucho.hessian.io; 50 51 import java.io.IOException ; 52 import java.io.InputStream ; 53 54 57 public class InputStreamSerializer extends AbstractSerializer { 58 public InputStreamSerializer() 59 { 60 } 61 62 public void writeObject(Object obj, AbstractHessianOutput out) 63 throws IOException  64 { 65 InputStream is = (InputStream ) obj; 66 67 if (is == null) 68 out.writeNull(); 69 else { 70 byte []buf = new byte[1024]; 71 int len; 72 73 while ((len = is.read(buf, 0, buf.length)) > 0) { 74 out.writeByteBufferPart(buf, 0, len); 75 } 76 77 out.writeByteBufferEnd(buf, 0, 0); 78 } 79 } 80 } 81 | Popular Tags |