📄 indent.java
字号:
/*
Copyright (C) 2003 Together
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.enhydra.xml;
/**
* @author Tweety
*
* A class that describes format of the output xml file.
*
* @version 1.0
*/
public class Indent {
/**
* Default tab value.
*/
public static String DEFAULT_TAB = " ";
/**
* Indent size.
*/
private int indent;
/**
* Tab string, the value that is going to be treated as tab.
*/
private String tab;
/**
* Constructs new <code>Indent</code> with the given size of indentation and the tab string.
*
* @param ind size of indentation.
* @param tab tab string.
*/
public Indent(int ind, String tab) {
this.indent = ind;
this.tab = tab;
}
/**
* toString method
* @return string
*/
public String toString() {
StringBuffer buff = new StringBuffer();
for (int i = 0; i < indent; i++)
buff.append(tab);
return buff.toString();
}
/**
* Increments the indentation size.
*/
public void increment() {
indent++;
}
/**
* Decrements the indentation size.
*/
public void decrement() {
indent--;
}
/**
* Returns the tab string.
* @return tab
*/
public String getTab() {
return tab;
}
/**
* Sets the tab string.
* @param tab is tab
*/
public void setTab(String tab) {
this.tab = tab;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -