on 06-24-2008 2:55 PM
BufferedReader in = new BufferredReader(new InputStreamReader(inStream));
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(outStream));
Pattern P = Pattern.compile("\032");
Matcher m = p.matcher("");
Hi
I have above piece of code. The purpose of the code is to remove the special characters when they come in input file.
Like to understand what the above lines of code do actually ?? Any java+XI experts plz help me
I am using the below packages
import java.util.regex.Matcher;
import java.util.regex.Pattern;
thanks
kumar
Hi,
It is checking the Pattern type and Matcher type. If you want to more about these classes what exactly the methods will do you can find in Java1.4 API search for java.util.Pattern and java.util.Matcher else if java installed in your machine.
run this command in command prompt
javap java.util.Pattern it will display all the methods with simple description. It's helpful for you to know about the methods functionality.
Thanks,
RamuV
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
"\032" is the decimal conversion for SPACE in ascii . Please refer to the link below for decimal to ascii units.
http://faculty.tp.devry.edu/~yhuh/ascii.htm
Thanks
Amit
Reward points if suggestion is useful
Hi,
This code is used in java mapping to identify the special character and remove it (CTRL+Z)
http://www.java2s.com/Code/Java/Regular-Expressions/Patterncompile.htm
http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html
ftp://kermit.columbia.edu/kermit/b/k11ins.doc
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You are importing Regular Expressions package using which you might want to findout a particular pattern when it occurs in the file, and you might want to take some action when it found.
But in the code given above, you didn't show that you are dealing with the input file. But you tried to find a particular pattern match.
Regards
Bhanu.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
This is not the complete code, you are not using in and out anywhere in the code. you have just read the file in the form of input stream at first line, opened an output stream at the second line, matching the pattern space in the next line and removing the same in the last line. I hope it clarifies your question.
Thanks
Amit
Reward points if answer is useful
Hi
This is not the full code. But the idea behind the actual code could be to identify a space character and remove the same.
Sameer
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.