title: Filter (search and replace) array of bytes in an InputStream
body: <p>I have an InputStream which takes the html file as input parameter. I have to get the bytes from the input stream .</p>
  
  <p>I have a string: <code>"XYZ"</code>. I'd like to convert this string to byte format and check if there is a match for the string in the byte sequence which I obtained from the InputStream. If there is then, I have to replace the match with the bye sequence for some other string.</p>
  
  <p>Is there anyone who could help me with this? I have used regex to find and replace. however finding and replacing byte stream, I am unaware of.</p>
  
  <p>Previously, I use jsoup to parse html and replace the string, however due to some utf encoding problems, the file seems to appear corrupted when I do that.</p>
  
  <p><strong>TL;DR: My question is:</strong></p>
  
  <p>Is a way to find and replace a string in byte format in a raw InputStream in Java?</p>