1 28 29 package com.caucho.jms.util; 30 31 import javax.jms.BytesMessage ; 32 import javax.jms.JMSException ; 33 import java.io.IOException ; 34 import java.io.OutputStream ; 35 import java.util.logging.Logger ; 36 37 40 public class BytesMessageOutputStream extends OutputStream 41 { 42 protected static Logger log 43 = Logger.getLogger(BytesMessageOutputStream.class.getName()); 44 45 private BytesMessage _message; 46 47 public BytesMessageOutputStream(BytesMessage message) 48 { 49 _message = message; 50 } 51 52 public void write(int b) 53 throws IOException 54 { 55 try { 56 _message.writeByte((byte) b); 57 } catch (JMSException e) { 58 throw new IOException (e.toString()); 59 } 60 } 61 62 public void write(byte[] buffer, int offset, int length) 63 throws IOException 64 { 65 try { 66 _message.writeBytes(buffer, offset, length); 67 } catch (JMSException e) { 68 throw new IOException (e.toString()); 69 } 70 } 71 72 public void write(byte[] buffer) 73 throws IOException 74 { 75 try { 76 _message.writeBytes(buffer); 77 } catch (JMSException e) { 78 throw new IOException (e.toString()); 79 } 80 } 81 } 82 | Popular Tags |