Coverage Report - com.ccg.macros.Output
 
Classes in this File Line Coverage Branch Coverage Complexity
Output
N/A 
N/A 
1
 
 1  
 /*----------------------------------------------------------------
 2  
  * $Id: Output.java,v 1.1.1.1 2004/01/26 20:46:18 pkb Exp $
 3  
  * 
 4  
  * (c)2000 - Paul Blankenbaker
 5  
  *
 6  
  * Revision Log
 7  
  * 
 8  
  *  2000-11-16 11:01:40        Paul Blankenbaker 
 9  
  * 
 10  
  *         Created initial version
 11  
  */
 12  
 //----------------------------------------------------------------
 13  
 
 14  
 package com.ccg.macros;
 15  
 
 16  
 import java.io.*;                // needed for I/O operations
 17  
 
 18  
 //----------------------------------------------------------------
 19  
 /** Interface defining what to do with text generated from output.
 20  
  * 
 21  
  * <p>As a "macro processor" is generating text output from the text
 22  
  * input it is processing, it will want a {@link Output Output} object
 23  
  * to store the output text to. This interface defines the methods
 24  
  * which such an output device must provide. Not exactly sure why I
 25  
  * didn't go with a standard Java {@link Writer Writer} class for this
 26  
  * - however its easy enough to convert a standard {@link Writer
 27  
  * Writer} to a {@link Output Output} object.
 28  
  *
 29  
  * <p>The following classes implement this interface and can probably
 30  
  * be used for most purposes:
 31  
  *
 32  
  * <dl>
 33  
  *
 34  
  * <dt>{@link OutputStringBuffer OutputStringBuffer}</dt><dd>Used when
 35  
  * one would like the results of the macro processing stored to a
 36  
  * string. Also handy for the creation of macro processing classes for
 37  
  * recursive processing.</dd>
 38  
  *
 39  
  * <dt>{@link OutputWriter OutputWriter}</dt><dd>Used for creating
 40  
  * output to a standard {@link Writer Writer}.</dd>
 41  
  *
 42  
  * </dl>
 43  
  * 
 44  
  * @version $Revision: 1.1.1.1 $
 45  
  * 
 46  
  * @since 1.0
 47  
  * 
 48  
  * @author $Author: pkb $
 49  
  * 
 50  
  * @see Interpreter
 51  
  * @see OutputWriter
 52  
  * @see OutputStringBuffer */
 53  
 //----------------------------------------------------------------
 54  
 
 55  
 public interface Output {
 56  
 
 57  
   //----------------------------------------------------------------
 58  
   /** Writes a set of characters from a buffer to the output.
 59  
    * 
 60  
    * This method is used by macro processors (such as the {@link
 61  
    * AtMacros AtMacros} class) to send a set of characters to the
 62  
    * output device (string, file, etc).
 63  
    * 
 64  
    * @param        buf
 65  
    * 
 66  
    *         A character array to take the data from (must not be null)
 67  
    * 
 68  
    * @param        ofs
 69  
    * 
 70  
    *         Offset into the buffer to the first character to start the
 71  
    *         copy from. Should be in the range of [0,buf.length-1].
 72  
    * 
 73  
    * @param        len
 74  
    * 
 75  
    *         How many characters to copy. When added to the offset, the
 76  
    *         resulting value should not exceed the length of the array.
 77  
    * 
 78  
    * @throws        IOException
 79  
    * 
 80  
    *         If a I/O error is encountered.
 81  
    * 
 82  
    * @since        1.0 */
 83  
   //----------------------------------------------------------------
 84  
 
 85  
   void write(char[] buf, int ofs, int len) throws IOException;
 86  
 
 87  
 
 88  
   //----------------------------------------------------------------
 89  
   /** Outputs the {@link java.lang.String string} representation of a {@link java.lang.Object Object}.
 90  
    * 
 91  
    * This method is used by macro processors (such as the {@link
 92  
    * AtMacros AtMacros} class) to cause the {@link java.lang.String
 93  
    * string} representation of a {@link java.lang.Object Object} to be
 94  
    * sent to the output device (string, file, etc).
 95  
    * 
 96  
    * @param        object
 97  
    * 
 98  
    *         The object to write out (the {@link java.lang.Object#toString
 99  
    *         toString()} method is used to write out the string
 100  
    *         representation of the object). You may pass null (in which
 101  
    *         case nothing will be done).
 102  
    * 
 103  
    * @throws        IOException
 104  
    * 
 105  
    *         If a I/O error is encountered.
 106  
    * 
 107  
    * @since        1.0 */
 108  
   //----------------------------------------------------------------
 109  
 
 110  
   void write(Object o) throws IOException;
 111  
 
 112  
 }