Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.enterprisedt.util.debug
Class MemoryAppender

    java.lang.Object
      com.enterprisedt.util.debug.StreamAppender
          com.enterprisedt.util.debug.MemoryAppender

All Implemented Interfaces:
  Appender

    public class MemoryAppender

extends StreamAppender

Appends log statements to an in-memory buffer.

Version:
  $Revision$
Author:
  Hans Andersen

Field Summary
`static int` | `DEFAULT_BUFFER_SIZE` Default size of memory-buffer (100k).

Fields inherited from class com.enterprisedt.util.debug.StreamAppender
`log, outStr`

Fields inherited from interface com.enterprisedt.util.debug.Appender
`cvsId`

Constructor Summary
`MemoryAppender()` Create a MemoryAppender whose buffer is initially set to 100k.
`MemoryAppender(int initSize)` Create a MemoryAppender whose buffer has the given initial size.

Method Summary
`byte[]` | `getBuffer()` Returns the current buffer.
`java.io.Reader` | `getReader()` Returns a reader that may be used to access the current buffer.
`void` | `print()` Writes the entire buffer to stdout.
`void` | `print(java.io.PrintStream stream)` Writes the entire buffer to the given writer.
`java.lang.String` | `toString()`

Methods inherited from class com.enterprisedt.util.debug.StreamAppender
`close, log, log`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### DEFAULT_BUFFER_SIZE

    public static final int DEFAULT_BUFFER_SIZE

  Default size of memory-buffer (100k).

  See Also:
    Constant Field Values

Constructor Detail

### MemoryAppender

    public MemoryAppender(int initSize)

  Create a MemoryAppender whose buffer has the given initial size.

  Parameters:
    `size` - Initial size of buffer.

### MemoryAppender

    public MemoryAppender()

  Create a MemoryAppender whose buffer is initially set to 100k.

Method Detail

### getBuffer

    public byte[] getBuffer()

  Returns the current buffer.

  Returns:
    the current buffer.

### getReader

    public java.io.Reader getReader()

  Returns a reader that may be used to access the current buffer. A snapshot of the buffer is taken at the time of invocation; any logging written to the appender after the invocation will not be accessible through the reader.

  Returns:
    A reader for the current buffer.

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### print

    public void print(java.io.PrintStream stream)

  Writes the entire buffer to the given writer.

  Parameters:
    `writer` - Writer to write to.

### print

    public void print()

  Writes the entire buffer to stdout.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 2001-2007 Enterprise Distributed Technologies Ltd. All Rights Reserved.