• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package com.fasterxml.jackson.core.io;
2 
3 import java.io.*;
4 
5 /**
6  * Handler class that can be used to decorate output destinations.
7  * Typical use is to use a filter abstraction (filtered output stream,
8  * writer) around original output destination, and apply additional
9  * processing during write operations.
10  */
11 @SuppressWarnings("serial")
12 public abstract class OutputDecorator implements java.io.Serializable // since 2.1
13 {
14     /**
15      * Method called by {@link com.fasterxml.jackson.core.JsonFactory} instance when
16      * creating generator for given {@link OutputStream}, when this decorator
17      * has been registered.
18      *
19      * @param ctxt IO context in use (provides access to declared encoding)
20      * @param out Original output destination
21      *
22      * @return OutputStream to use; either passed in argument, or something that
23      *   calls it
24      */
decorate(IOContext ctxt, OutputStream out)25     public abstract OutputStream decorate(IOContext ctxt, OutputStream out) throws IOException;
26 
27     /**
28      * Method called by {@link com.fasterxml.jackson.core.JsonFactory} instance when
29      * creating generator for given {@link Writer}, when this decorator
30      * has been registered.
31      *
32      * @param ctxt IO context in use (provides access to declared encoding)
33      * @param w Original output writer
34      *
35      * @return Writer to use; either passed in argument, or something that calls it
36      */
decorate(IOContext ctxt, Writer w)37     public abstract Writer decorate(IOContext ctxt, Writer w) throws IOException;
38 }
39