com.amazonaws.codegen.emitters

## Class CodeWriter

- java.lang.Object
- - java.io.Writer
  - - java.io.StringWriter
    - - com.amazonaws.codegen.emitters.CodeWriter

All Implemented Interfaces:
  Closeable, Flushable, Appendable, AutoCloseable

    public class CodeWriter
    extends StringWriter

Formats the generated code and write it to the underlying file. The caller should call the flush method to write the contents to the file. This class is intended to be used only by the code generation system and is not to be used for public use.

### Field Summary

### Fields inherited from class java.io.Writer

`lock`

### Constructor Summary

Constructors
Constructor and Description
`CodeWriter(String dir, String file)` Constructor to use for .java files.
`CodeWriter(String dir, String file, String fileNameSuffix)` Constructor to use for custom file suffixes.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `flush()` This method is expected to be called only once during the code generation process after the template processing is done.

### Methods inherited from class java.io.StringWriter

`append, append, append, close, getBuffer, toString, write, write, write, write`

### Methods inherited from class java.io.Writer

`write`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### CodeWriter

    public CodeWriter(String dir,
                      String file)

Constructor to use for .java files.

Parameters:
  `dir` - output directory where the file is to be created.
  `file` - name of the file without .java suffix.

#### CodeWriter

    public CodeWriter(String dir,
                      String file,
                      String fileNameSuffix)

Constructor to use for custom file suffixes.

Parameters:
  `dir` - output directory where the file is to be created.
  `file` - name of the file excluding suffix.
  `fileNameSuffix` - suffix to be appended at the end of file name.

### Method Detail

#### flush

    public void flush()

This method is expected to be called only once during the code generation process after the template processing is done.

Specified by:
  `flush` in interface `Flushable`
Overrides:
  `flush` in class `StringWriter`