1 9 package org.ozoneDB.blob; 10 11 import java.io.*; 12 13 14 24 public class BLOBOutputStream extends OutputStream implements Serializable { 25 26 BLOBContainer container; 27 int index = 0; 28 29 30 public BLOBOutputStream( BLOBContainer _container ) { 31 container = _container; 32 } 33 34 35 public void write( byte[] b ) throws IOException { 36 write( b, 0, b.length ); 37 } 38 39 40 public void write( byte[] b, int off, int len ) throws IOException { 41 try { 42 container.write( index, b, off, len ); 43 index += len; 44 } catch (Exception e) { 45 e.printStackTrace(); 46 throw new IOException( e.getMessage() ); 47 } 48 } 49 50 51 public void write( int b ) throws IOException { 52 byte[] bb = new byte[1]; 53 bb[0] = (byte)b; 54 write( bb, 0, 1 ); 55 } 56 57 58 public void flush() throws IOException { 59 } 60 61 62 public void close() throws IOException { 63 } 64 } 65 | Popular Tags |