StringBufferInputStream deprecation

Discussion in 'Java' started by Silas Snider, Aug 25, 2004.

  1. Silas Snider

    Silas Snider Guest

    Dear List,
    I am using a DigestInputStream to perform a digest function on
    passwords that get stored in an arbitrary database. (I can't use a database
    function to do the same thing, because the program is designed to work with
    as many dbs as possible including text files)
    Anyway, I am using a StringBufferInputStream to pass a string into the
    DigestInputStream, when lo and behold, Eclipse tells me that the
    StringBufferInputStream class is deprecated. The api says to use
    StringReader instead, but DigestInputStream accepts only InputStreams as
    input. Is there another digesting class that I didn't see that will do
    strings? Or is there a way to change a Reader into an InputStream?

    Thanks,
    Silas Snider
    Silas Snider, Aug 25, 2004
    #1
    1. Advertising

  2. Silas Snider

    Sudsy Guest

    Silas Snider wrote:
    > Dear List,
    > I am using a DigestInputStream to perform a digest function on
    > passwords that get stored in an arbitrary database. (I can't use a database
    > function to do the same thing, because the program is designed to work with
    > as many dbs as possible including text files)
    > Anyway, I am using a StringBufferInputStream to pass a string into the
    > DigestInputStream, when lo and behold, Eclipse tells me that the
    > StringBufferInputStream class is deprecated. The api says to use
    > StringReader instead, but DigestInputStream accepts only InputStreams as
    > input. Is there another digesting class that I didn't see that will do
    > strings? Or is there a way to change a Reader into an InputStream?


    Always check the javadocs. Since the only constructor for
    StringBufferInputStream is a java.lang.String, why not something like
    this:

    InputStream is = new ByteArrayInputStream( s.getBytes() );

    (where s is the java.lang.String passed to the StringBufferInputStream
    constructor)

    You can then use is as the first argument to the DigestInputStream
    constructor.
    Sudsy, Aug 25, 2004
    #2
    1. Advertising

  3. Sudsy <> wrote in
    news::
    > Always check the javadocs. Since the only constructor for
    > StringBufferInputStream is a java.lang.String, why not something like
    > this:
    >
    > InputStream is = new ByteArrayInputStream( s.getBytes() );
    >
    > (where s is the java.lang.String passed to the StringBufferInputStream
    > constructor)
    >
    > You can then use is as the first argument to the DigestInputStream
    > constructor.
    >
    >


    Thanks! It works perfectly.
    Simon Fairfax, Aug 25, 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. Ray Mitchell
    Replies:
    1
    Views:
    347
  2. John English
    Replies:
    5
    Views:
    27,950
    John English
    Oct 1, 2004
  3. e n | c k m a

    <img> deprecation

    e n | c k m a, Aug 19, 2003, in forum: HTML
    Replies:
    4
    Views:
    427
    Headless
    Aug 19, 2003
  4. fuzzylollipop
    Replies:
    3
    Views:
    1,093
    John Carson
    Jan 5, 2005
  5. Patricia Shanahan

    What replaces StringBufferInputStream

    Patricia Shanahan, Aug 29, 2006, in forum: Java
    Replies:
    45
    Views:
    19,919
    Dale King
    Sep 5, 2006
Loading...

Share This Page