indent String in Writer - Android XML

Android examples for XML:XML String

Description

indent String in Writer

Demo Code


//package com.java2s;
import java.io.IOException;
import java.io.Writer;

public class Main {
    public static void indent(Writer writer, int i) throws IOException {
        writer.write("\n");
        printSpace(writer, i);/*w ww.  j  a  va2  s  .  c o  m*/
    }

    public static void printSpace(Writer writer, int i) throws IOException {
        for (int j = 0; j < i; j++)
            writer.write(" ");
    }
}

Related Tutorials