1 16 17 package org.apache.axis.message; 18 19 import org.apache.axis.components.logger.LogFactory; 20 import org.apache.axis.encoding.SerializationContext; 21 import org.apache.axis.utils.IOUtils; 22 import org.apache.axis.utils.Messages; 23 import org.apache.commons.logging.Log; 24 25 import java.io.IOException ; 26 import java.io.InputStream ; 27 28 29 public class InputStreamBody extends SOAPBodyElement 30 { 31 protected static Log log = 32 LogFactory.getLog(InputStreamBody.class.getName()); 33 34 protected InputStream inputStream; 35 36 public InputStreamBody(InputStream inputStream) 37 { 38 this.inputStream = inputStream; 39 } 40 41 public void outputImpl(SerializationContext context) throws IOException 42 { 43 try { 44 byte[] buf = new byte[ inputStream.available() ]; 45 IOUtils.readFully(inputStream,buf); 46 String contents = new String (buf); 47 context.writeString(contents); 48 } 49 catch( IOException ex ) { 50 throw ex; 51 } 52 catch( Exception e ) { 53 log.error(Messages.getMessage("exception00"), e); 54 } 55 } 56 } 57 | Popular Tags |