private static final ZLibResult compress(byte[] text) throws IOException {
        if (text.length == 0) {
            return new ZLibResult(text, false);
        }

        int length = text.length;
        byte[] bin = null;

        if (length < 44) {
            /* NOP */
        }
        // DCI: required for Java?
        // else if (length > 1000000) {
        //     // # zlib makes an internal copy, thus doubling memory usage for
        //     // # large files, so lets do this in pieces
        //     // z = zlib.compressobj()
        //     // p = []
        //     // pos = 0
        //     // while pos < l:
        //     //     pos2 = pos + 2**20
        //     //     p.append(z.compress(text[pos:pos2]))
        //     //     pos = pos2
        //     // p.append(z.flush())
        //     // if sum(map(len, p)) < l:
        //     //     bin = "".join(p)
        // }
        else {
            bin = doCompress(text);
            //System.err.println("Compressed: " + text.length + " to: " + bin.length);
        }

        if (bin == null || bin.length > length) {
            if (text[0] == 0) {
                return new ZLibResult(text, false);
            }
            return new ZLibResult(text, true);
        }
        return new ZLibResult(bin, false);
    }