java.lang.Object
java.io.Writer
java.io.StringWriter
software.amazon.awssdk.codegen.lite.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.
  • Constructor Details

    • 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 Details

    • 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