Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > A file filter question

Reply
Thread Tools

A file filter question

 
 
mikeotp
Guest
Posts: n/a
 
      12-13-2004
regards:
------------------------------------------------------------------
public FileOutputStream doFunction(FileInputStream file1) {

<--codes to filter some specific characters or String in file1-->

<--
example following:
characters:a
String:<test>
-->


}

FileOutputStrea is different from FileInputStream
by some specific characters or String.


------------------------------------------------------------------
How can I compose my code?^^
Any suggestions is welcome.

Thank you.
May god be with you.
 
Reply With Quote
 
 
 
 
The Abrasive Sponge
Guest
Posts: n/a
 
      12-13-2004
mikeotp wrote:


> Thank you.
> May god be with you.


Can I help even though I am agnostic?

public class MyFilter extends FilterReader {
//method removes all 'a' characters
public int read() {
char c = super.read();
if (c == 'a') {
return this.read();
}
}

}

I haven't compiled this...but clean it up, compile and attach it to a
FileReader and give it a try.


 
Reply With Quote
 
 
 
 
The Abrasive Sponge
Guest
Posts: n/a
 
      12-13-2004
The Abrasive Sponge wrote:

> mikeotp wrote:
>
>
>> Thank you.
>> May god be with you.

>
>
> Can I help even though I am agnostic?
>
> public class MyFilter extends FilterReader {
> //method removes all 'a' characters
> public int read() {
> char c = super.read();
> if (c == 'a') {
> return this.read();
> }
> }
>
> }
>
> I haven't compiled this...but clean it up, compile and attach it to a
> FileReader and give it a try.
>
>


public class MyFilter extends FilterReader {
//method removes all 'a' characters
public int read() {
char c = super.read();
if (c == 'a') {
return this.read();
} else {
return c; //Correction
}
}
}
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What is Anti-Spam Filter.(thunderbird spam filter) zax75 Java 1 03-28-2008 06:43 AM
"rec.photo.digital.txt" Filter File Posted Online (for newsreadersthat can import a list of e-mail addresses to filter out) SMS 斯蒂文• 夏 Digital Photography 2 11-25-2007 11:00 AM
Polarising filter with UV filter? Stimp Digital Photography 23 11-17-2006 11:51 AM
to filter of not to filter Ken Digital Photography 2 12-23-2005 12:45 PM
UV Protector filter vs. Skylight filter? john Digital Photography 8 06-26-2004 03:44 PM



Advertisments