A file filter question

Discussion in 'Java' started by mikeotp, Dec 13, 2004.

  1. mikeotp

    mikeotp Guest

    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.
    mikeotp, Dec 13, 2004
    #1
    1. Advertising

  2. 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.
    The Abrasive Sponge, Dec 13, 2004
    #2
    1. Advertising

  3. 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
    }
    }
    }
    The Abrasive Sponge, Dec 13, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Yttrium

    FIR filter design + COE file

    Yttrium, Feb 9, 2004, in forum: VHDL
    Replies:
    1
    Views:
    2,926
  2. =?Utf-8?B?YW5kcmV3MDA3?=

    question row filter (more of sql query question)

    =?Utf-8?B?YW5kcmV3MDA3?=, Oct 5, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    939
    Scott Allen
    Oct 6, 2005
  3. Handy Andy
    Replies:
    6
    Views:
    32,115
    djdyson
    May 5, 2009
  4. Asela Gunawardena
    Replies:
    1
    Views:
    2,361
    Nathan Sokalski
    Dec 21, 2005
  5. zax75
    Replies:
    1
    Views:
    1,094
Loading...

Share This Page