title: Detect if the inputstream is deflated or not
body: <p>I need and approach to this situation, I have read a lot and I haven't found any examples or text about it. I have one server socket which receives data from 2 clients : a) from a client that sends deflated streams. b) from a client that sends ASCII stream.</p>
  
  <p>a) Receiving Deflated stream:</p>
  
  <pre><code>inflater = new InflaterInputStream(clientSocket.getInputStream());
  bout = new ByteArrayOutputStream(3025);
  int b;
  while ((b = inflater.read()) != -1) {
      bout.write(b);
  }
  strMessage = new String(bout.toByteArray());
  </code></pre>
  
  <p>b) Receiving from an ASCII stream :</p>
  
  <pre><code>bufferEnt = new char[3025];
  Arrays.fill(bufferEnt,' ');
  input = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
  intLongBuffer = input.read(bufferEnt);
  strMessage = new String(bufferEnt).trim();
  </code></pre>
  
  <p>On each individual situation this code works fine, and the variable <code>strMessage</code> has the correct information, but I need to identified when the stream is deflated and when is not, so I can apply the correct piece of code to each case, that's my big problem here!</p>