Java Reference
In-Depth Information
Example 3-7. Entab.java
public
public class
EnTab {
/** The Tabs (tab logic handler) */
protected
class EnTab
protected Tabs tabs ;
/**
* Delegate tab spacing information to tabs.
*/
public
public int
int getTabSpacing () {
return
return tabs . getTabSpacing ();
}
/**
* Main program: just create an EnTab object, and pass the standard input
* or the named file(s) through it.
*/
public
public static
static void
void main ( String [] argv ) throws
throws IOException {
EnTab et = new
new EnTab ( 8 );
iif ( argv . length == 0 ) // do standard input
et . entab (
new
new BufferedReader ( new
new InputStreamReader ( System . in )),
System . out );
else
else
for ( String fileName : argv ) { // do each file
et . entab (
new
new BufferedReader ( new
new FileReader ( fileName )),
System . out );
}
}
/**
* Constructor: just save the tab values.
*
* @param n
* The number of spaces each tab is to replace.
*/
public
public EnTab ( int
int n ) {
tabs = new
new Tabs ( n );
}
public
public EnTab () {
tabs = new
new Tabs ();
}
/**
Search WWH ::




Custom Search