/* * Copyright (c) 1999,2006 Declarative Engineering LLC. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Declarative Engineering LLC * verson 1 which accompanies this distribution, and is available at * http://declarativeengineering.com/legal/DE_Developer_License_v1.txt */ package com.common.io; import java.io.PrintWriter; /* * A print writer that simply wrappers a string buffer and whose string can be retreived by calling toString(). * This is useful for retrieving a stack trace using exception.printStackTrace(PrintWriter). */ public class StringBufferPrintWriter extends PrintWriter { /** * StringBufferPrintWriter constructor. * @param file * @throws FileNotFoundException */ public StringBufferPrintWriter(StringBuffer buffer) { super(new StringBufferWriter(buffer)); }//StringBufferPrintWriter()// /** * StringBufferPrintWriter constructor. */ public StringBufferPrintWriter() { super(new StringBufferWriter(new StringBuffer(1000))); }//StringBufferPrintWriter()// /* (non-Javadoc) * @see java.lang.Object#toString() */ public String toString() { return ((StringBufferWriter) out).toString(); }//toString()// }//StringBufferPrintWriter//