Code example for DeflaterInputStream

    if (name.endsWith(".zip")) {
      return new ZipInputStream(in);
    if (name.endsWith(".deflate")) {
      return new DeflaterInputStream(in);
    return in;
   * @param in   stream to read and copy 
   * @param file file to write stream's contents to 
   * @throws IOException if the stream can't be read or the file can't be written 
  public static void copyStreamToFile(InputStream in, File file) throws IOException {
    FileOutputStream out = new FileOutputStream(file);
    try { 
      ByteStreams.copy(in, out);
    } finally { 
Experience pair programming with AI  Get Codota for Java