Answers for "simple text formatter as in textbook"

0

simple text formatter as in textbook

import java.io.*; import java.util.*; /** * Fmt - format text (like Berkeley Unix fmt). */ public class Fmt { /** The maximum column width */ public static final int COLWIDTH=72; /** The file that we read and format */ BufferedReader in; /** If files present, format each, else format the standard input. */ public static void main(String[] av) throws IOException { if (av.length == 0) new Fmt(System.in).format( ); else for (int i=0; i<av.length; i++) new Fmt(av[i]).format( ); } /** Construct a Formatter given a filename */ public Fmt(String fname) throws IOException { in = new BufferedReader(new FileReader(fname)); ...
Posted by: Guest on October-15-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language