Class crlf
java.lang.Object
|
+----crlf
- public class crlf
- extends Object
- implements FilenameFilter
How many times have you transferred files from a UNIX machine to
Windows or vice versa and then discovered that you did a binary
transfer by mistake? What do you do then? You can ftp them again!
What about downloaded files? I can give you one example - JDK
sources from Sun. They always come with UNIX style line feeds only.
Viewing them with notepad becomes a pain.
So here's an utility to make life simpler. Just run this utility
against your file and bingo! all those black boxes and ^M are gone.
Usage:
java crlf [-template template] [-recurse] file1 file2 ...
template can be a simple wild card with '*' and '?'
recurse option enables resursing sub-directories
filename can be name of a file or a directory
You are free to use this code and to make modifications provided
this notice is retained.
If you found this useful, please add a note of acknowledgement to my guestbook,
or send me a mail at tanmaykm@hotmail.com.
If you would like to report a bug or suggest some improvements,
you are most welcome. I will be happy to help you use this piece of code.
- Version:
- 1.00, 7th Jan, 1999
- Author:
- Tanmay K. Mohapatra
-
crlf(File, String, boolean, boolean)
- The same class acts as a FilenameFilter.
-
accept(File, String)
- Accept returns true if the file passes the filter.
-
convertFile(String, String)
- Convert all line separators in this file.
-
main(String[])
-
-
matchWildCard(String, String)
- Function matches simple wild cards containing '?' or '*'
-
processFile(String, String, String, boolean, boolean)
- process this file or if it is a directory then process the files within that.
crlf
public crlf(File dir,
String sTemplate,
boolean bFiles,
boolean bDirs)
- The same class acts as a FilenameFilter. This is the constructor for that.
accept
public boolean accept(File dir,
String sFileName)
- Accept returns true if the file passes the filter.
matchWildCard
public boolean matchWildCard(String sFullString,
String sPartialExp)
- Function matches simple wild cards containing '?' or '*'
main
public static void main(String args[])
- Parameters:
- args - Array of file names to scan.
processFile
public static void processFile(String sFileName,
String sFileTemplate,
String sLineSep,
boolean bRecurse,
boolean bFirstLevel)
- process this file or if it is a directory then process the files within that.
convertFile
public static void convertFile(String sFileName,
String sLineSep)
- Convert all line separators in this file.