Hello guys,
I'm trying to create a method where it takes a InputStream as a parameter, reads the stream and returns the number of characters it contains as an int.
I'm having difficulties with this. I've searched the internet for examples, but i can't find one that helps me with the method i'm creating. Here's my code so far...
public int countNo(InputStream stream)throws IOException
{
try {
stream = new InputStream();
while ((stream = input.read()) != -1) {
input.write(c);
}
} finally {
if (input != null) {
input.close();
}
}
return stream;
}
Can anyone here guide me with completing this method, because i'm having difficulties with it.