Java tutorial
//package com.java2s; public class Main { private static final String C_HEADER_NONE_VAL = "plaintext"; private static final String C_HEADER_ZLIB_VAL = "deflate"; private static final String C_HEADER_GZIP_VAL = "gzip"; private static final int NONE = 0; private static final int GZIP = 1; private static final int ZLIB = 2; private static int getCompressionType(String header) { String s = header.trim(); if (s.equals("") || s.equalsIgnoreCase(C_HEADER_NONE_VAL)) return NONE; else if (s.equalsIgnoreCase(C_HEADER_GZIP_VAL)) return GZIP; else if (s.equalsIgnoreCase(C_HEADER_ZLIB_VAL)) return ZLIB; else return -1; } }