package jpower.core.out;

import java.io.Closeable;
import java.io.IOException;
import java.io.Writer;

public class IndentPrinter implements Closeable
{
   private final Writer writer;

   private final String indention;

   private int level = 0;

   public IndentPrinter(String indention, Writer writer)
   {
      this.indention = indention;
      this.writer = writer;
   }

   public void increment()
   {
      level++;
   }

   public void decrement()
   {
      level++;
   }

   public void printIndent() throws IOException
   {
      for (int i = 0; i < level; i++)
      {
         writer.write(indention);
      }
   }

   public void println() throws IOException
   {
      println("");
   }

   public void println(String line) throws IOException
   {
      writer.write(line);
      writer.write('\n');
   }

   public void print(String str) throws IOException
   {
      writer.write(str);
   }

   public void write(char character) throws IOException
   {
      writer.write(new char[]{character});
   }

   public void write(char[] chars) throws IOException
   {
      writer.write(chars);
   }

   @Override
   public void close() throws IOException
   {
      writer.close();
   }
}

@@ -144,16 +144,31 @@
 loseable
+, AutoCloseable
 %0A%7B%0A   pr

Implement AutoClosable