J
jason
Self proclaimed java newbie here .. I've done some research but I might
be going in the wrong direction on this on. I'm trying to build a
simple J2ME text file search that returns every LINE that contains a
STRING in a resource file text file. Problem is, apparently regex and
split are apparently not available in J2ME .. so I'm trying to do this
with StringBuffer .. Maybe there is a better way to do this??
=== code block
private String readHelpText()
{
InputStream is = getClass().getResourceAsStream("help.txt");
String[] loadit = null;
int chr = 0;
try
{
StringBuffer sb = new StringBuffer();
// Read until the end of the stream
while ((chr = is.read()) != -1)
{
sb.append((char) chr);
// below does not work
// loadit[chr] = sb.charAt(chr);
// code I need might go here if I could get charAt to work?
//
System.out.println(chr); // this display a sequence of
numbers out of order???
}
return sb.toString();
}
catch (Exception e)
{
System.out.println("Unable to create stream ");
System.out.println(chr);
}
return null;
}
}
====
Thank you for any information or help.
be going in the wrong direction on this on. I'm trying to build a
simple J2ME text file search that returns every LINE that contains a
STRING in a resource file text file. Problem is, apparently regex and
split are apparently not available in J2ME .. so I'm trying to do this
with StringBuffer .. Maybe there is a better way to do this??
=== code block
private String readHelpText()
{
InputStream is = getClass().getResourceAsStream("help.txt");
String[] loadit = null;
int chr = 0;
try
{
StringBuffer sb = new StringBuffer();
// Read until the end of the stream
while ((chr = is.read()) != -1)
{
sb.append((char) chr);
// below does not work
// loadit[chr] = sb.charAt(chr);
// code I need might go here if I could get charAt to work?
//
System.out.println(chr); // this display a sequence of
numbers out of order???
}
return sb.toString();
}
catch (Exception e)
{
System.out.println("Unable to create stream ");
System.out.println(chr);
}
return null;
}
}
====
Thank you for any information or help.