On May 4, 7:46 pm, el mio uno y dos <[email protected]> wrote:
> Hello companion, I have the following problem in exercise I/O Stream, have 
> created the two classes, in the class read, with himself that the document 
> reads it changes and it to capital letters, but now not like following. 
> Somebody can help me please?
>
> public class ChangeToUpperCaseInputStream extends FilterInputStream{
>     String b="";
>     public ChangeToUpperCaseInputStream (InputStream in){
>         super (in);
>     }
>
This is ok.

>  public StringBuilder StreamToUpper() {
>
>      BufferedReader buff = new BufferedReader(new 
> InputStreamReader(super.in));
>      StringBuilder str = new StringBuilder();
>      String line = null;
>
>      try {
>          while((line=buff.readLine())!=null) {              
>              str.append(line.toUpperCase() + "\n");        Here read a file 
> and change to uppercase, but how can i following???
>
>          }
>                   return str;
>          } catch (IOException e) {}
>       return null;
>          }
This is absolutely not OK, since as you discovered yourself, you need
an int, or a char (which can be converted from/to an int)

>
>  public int read() throws IOException {
>
>      int c = StreamToUpper().read();          Here have a problem, because 
> requiere int
>           return c;
>
>      }
>     }
Here you should read in, then pass the result to a method which
convert an int to another int, in which you take the int, convert it
to a char, take the char to build a string, convert this string to
uppercase, reconvert the new string to a char, and return the int
equivalent to the char. And return the result to the read method. Then
it would work.
>
> _________________________________________________________________
> ¡Quítate unos clics! Ahora, Internet Explorer 8 tiene todo lo que te gusta de 
> Windows Live ¡Consíguelo 
> gratis!http://ie8.msn.com/microsoft/internet-explorer-8/es-es/ie8.aspx
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to