-1

I'm Having issues troubleshooting this issue from the past 48 hours and constant googling around for a workaround but I couldn't find any way to solve this issue.

Well, I want to know that How to check input stream is ByteArrayInputStream or it's a simple StringInputStream?

Thanks.

Saif Ali
  • 429
  • 5
  • 23

1 Answers1

4

Use instanceof to check the type of an instance. This is valid for any type of instance and not just inputsreams.

for example:

if (inputStream instanceof ByteArrayInputStream){
 do something
}

else if(inputStream instanceof StringInputStream){
  do something else
}
Daniel B.
  • 2,491
  • 2
  • 12
  • 23