00001 /*- 00002 * See the file LICENSE for redistribution information. 00003 * 00004 * Copyright (c) 2000-2005 00005 * Sleepycat Software. All rights reserved. 00006 * 00007 * $Id: SerialBase.java,v 12.1 2005/08/01 20:25:04 mark Exp $ 00008 */ 00009 00010 package com.sleepycat.bind.serial; 00011 00012 import com.sleepycat.util.FastOutputStream; 00013 00026 public class SerialBase { 00027 00028 private int outputBufferSize; 00029 00036 public SerialBase() { 00037 outputBufferSize = 0; 00038 } 00039 00050 public void setSerialBufferSize(int byteSize) { 00051 outputBufferSize = byteSize; 00052 } 00053 00061 public int getSerialBufferSize() { 00062 return outputBufferSize; 00063 } 00064 00085 protected FastOutputStream getSerialOutput(Object object) { 00086 int byteSize = getSerialBufferSize(); 00087 if (byteSize != 0) { 00088 return new FastOutputStream(byteSize); 00089 } else { 00090 return new FastOutputStream(); 00091 } 00092 } 00093 }