Initial commit from SVN.
This commit is contained in:
37
Common/src/com/common/io/StringBufferPrintWriter.java
Normal file
37
Common/src/com/common/io/StringBufferPrintWriter.java
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* 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 <code>exception.printStackTrace(PrintWriter)</code>.
|
||||
*/
|
||||
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//
|
||||
Reference in New Issue
Block a user