6

我有一个数据样本:

byte[] b = new byte[]{120, 1, -67, -107, -51, 106, 20, 81, 16, -123, 107, 18, -51, -60, 31, -30, 117, -4, -53, -60, -123, 25, 70, 71, 23, -111, 89, 12, 8, -83, 49, 4, -14, -93, -63, 73, 32, 89, -55, -112, -123, 10, -30, 66, 69, -110, 69, -64, -107, -77, 8, -72, 21, 23, -82, 5, -97, -64, 55, -48, -73, -16, 97, 4, -3, 14, -23, -110, 75, 59, 125, 39, 8, -10, -123, 51, -73, -86, -85, -6, 84, -99, -22, -18, 59, 53, 51, 27, 2, 95, 7, 24, 95, -36, 97, 95, 9, 102, -17, 46, -101, -51, -81, 109, -82, -101, -43, 44, -100, 54, -5, -56, -11, 9, -128, 105, -81, -128, -42, -25, -109, 102, -121, -109, 102, 63, 107, 102, 75, 32, 94, 79, -66, -43, 109, -15, -57, 9, 91, -79, 55, -74, 111, -49, -71, 103, -51, 54, 13, 58, -42, 121, 112, 22, 76, 3, -15, 5, -32, -21, 20, 70, 0, -94, 19, -58, -59, -59, 19, -128, -81, 51, 24, 1, -8, -3, 23, -80, -107, 35, -1, 38, -104, -51, 109, 54, 123, -12, -6, -67, 54, -69, 1, 60, -57, 109, 122, 27, -34, -29, -70, 122, -68, 10, 2, 80, 111, -102, -45, 29, 16, -64, 1, 40, -6, 15, -71, -26, -15, 45, -20, 103, 5, -1, 65, -28, 95, -57, 126, 90, -16, -69, -111, -33, -64, 46, -6, 47, -93, -72, -6, -39, 3, -9, -127, -6, 92, -52, -9, 37, -10, 89, -96, -72, -18, -9, 62, 93, 91, 29, 109, 110, 19, 30, -34, -30, -57, -11, 23, 103, -12, -31, -21, 119, -94, -57, -97, 81, 32, -9, 54, 120, 12, -60, -21, -21, 87, -66, 120, 93, -84, 73, 70, -117, -89, -47, -78, -7, 100, 94, 11, 21, 77, 107, 48, -21, 70, 50, -81, 78, -4, 72, 113, -102, 79, 111, 64, -99, -38, 1, -108, -51, 76, -3, -118, -83, 5, -92, -61, -25, -12, 63, 103, -42, -50, -21, -92, 102, -74, 64, 39, 61, -69, 6, -82, 36, 103, -47, 67, -35, 2, 95, 77, 27, -92, -8, -26, -120, 31, 77, 54, -51, -41, -96, -26, 28, -75, -37, -96, 108, 102, -102, -105, -66, -45, 94, -82, -93, -118, -103, 101, -44, -46, -5, -107, -46, -72, 74, 70, -97, 39, -39, -25, 61, 74, -27, -11, -19, -100, -83, -14, 5, 101, 32, -107, -41, 37, -34, 33, -73, 51, -122, -81, 67, -51, 46, -75, 51, 80, 54, -77, 14, -67, 79, -125, 126, -82, -93, -118, -103, 109, 80, 75, 103, 89, 74, -29, 14, 25, 3, -69, 4, 102, -110, 121, 3, -101, -78, 29, -72, -60, -103, -30, 91, 38, -98, -111, -101, -115, -31, -53, -88, -71, 76, -19, 13, 80, 54, 51, 61, 115, -83, 1, -112, -114, 127, -103, 25, -57, -112, 40, -2, -36, 91, -117, 108, -98, -57, 95, 103, 126, -109, -8, 39, -32, 103, -70, -50, -20, -94, -1, 54, -118, 43, 95, 126, -103, 6, -113, 59, 79, 21, 26, -12, 31, 16, -9, 124, 119, -124, 31, 107, 80, 126, 74, -125, -57, -99, -89, 10, 13, -21, -123, -98, -73, 71, -8, -79, 6, -27, -89, 52, 120, -36, 121, -86, -48, -80, 91, -24, -7, -59, 8, 63, -42, -96, -4, -108, 6, -113, 59, -49, 113, 52, -52, -64, 121, 17, 104, 5, 32, -5, 55, -108, 74, -2, -44};

它只是一个压缩的 EMF 图像。我尝试通过代码解压:

    InflaterInputStream iis = new InflaterInputStream(new ByteArrayInputStream(b));
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    byte[] buf = new byte[4096];
    int length = 0;
    while ((length = iis.read(buf)) > 0) {
        baos.write(buf, 0, length);
    }

并得到正确答案

[1, 0, 0, 0, -128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 118, 0, 0, 0, -93, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67, 16, 0, 0, 127, 22, 0, 0, 32, 69, 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, 54, 0, 0, 0, 16, 0, 0, 0, 36, 0, 0, 0, 97, 0, 0, 0, 54, 0, 0, 0, 16, 0, 0, 0, 36, 0, 0, 0, 47, 0, 0, 0, 54, 0, 0, 0, 16, 0, 0, 0, 18, 0, 0, 0, 47, 0, 0, 0, 54, 0, 0, 0, 16, 0, 0, 0, 18, 0, 0, 0, 107, 0, 0, 0, 54, 0, 0, 0, 16, 0, 0, 0, 9, 0, 0, 0, 113, 0, 0, 0, 61, 0, 0, 0, 8, 0, 0, 0, 60, 0, 0, 0, 8, 0, 0, 0, 62, 0, 0, 0, 24, 0, 0, 0, 9, 0, 0, 0, 47, 0, 0, 0, 118, 0, 0, 0, -93, 0, 0, 0, 37, 0, 0, 0, 12, 0, 0, 0, 7, 0, 0, -128, 37, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, -128, 40, 0, 0, 0, 12, 0, 0, 0, 1, 0, 0, 0, 39, 0, 0, 0, 24, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, -112, -79, -63, 0, 0, 0, 0, 0, 37, 0, 0, 0, 12, 0, 0, 0, 1, 0, 0, 0, 37, 0, 0, 0, 12, 0, 0, 0, 8, 0, 0, -128, 59, 0, 0, 0, 8, 0, 0, 0, 27, 0, 0, 0, 16, 0, 0, 0, 16, 0, 0, 0, 45, 0, 0, 0, 88, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, 3, 0, 0, 0, 25, 0, 45, 0, 33, 0, 39, 0, 33, 0, 32, 0, 88, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, 3, 0, 0, 0, 33, 0, 24, 0, 25, 0, 18, 0, 16, 0, 18, 0, 88, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, 3, 0, 0, 0, 7, 0, 18, 0, 0, 0, 24, 0, 0, 0, 32, 0, 88, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, 3, 0, 0, 0, 0, 0, 39, 0, 7, 0, 45, 0, 16, 0, 45, 0, 61, 0, 0, 0, 8, 0, 0, 0, 60, 0, 0, 0, 8, 0, 0, 0, 62, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 33, 0, 0, 0, 45, 0, 0, 0, 37, 0, 0, 0, 12, 0, 0, 0, 7, 0, 0, -128, 37, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, -128, 40, 0, 0, 0, 12, 0, 0, 0, 1, 0, 0, 0, 39, 0, 0, 0, 24, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, -112, -79, -63, 0, 0, 0, 0, 0, 37, 0, 0, 0, 12, 0, 0, 0, 1, 0, 0, 0, 37, 0, 0, 0, 12, 0, 0, 0, 8, 0, 0, -128, 59, 0, 0, 0, 8, 0, 0, 0, 27, 0, 0, 0, 16, 0, 0, 0, 35, 0, 0, 0, 37, 0, 0, 0, 88, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, 3, 0, 0, 0, 44, 0, 37, 0, 51, 0, 31, 0, 51, 0, 23, 0, 88, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, 3, 0, 0, 0, 51, 0, 16, 0, 44, 0, 10, 0, 35, 0, 10, 0, 88, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, 3, 0, 0, 0, 26, 0, 10, 0, 18, 0, 16, 0, 18, 0, 23, 0, 88, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, 3, 0, 0, 0, 18, 0, 31, 0, 26, 0, 37, 0, 35, 0, 37, 0, 61, 0, 0, 0, 8, 0, 0, 0, 60, 0, 0, 0, 8, 0, 0, 0, 62, 0, 0, 0, 24, 0, 0, 0, 18, 0, 0, 0, 10, 0, 0, 0, 51, 0, 0, 0, 37, 0, 0, 0, 37, 0, 0, 0, 12, 0, 0, 0, 7, 0, 0, -128, 37, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, -128, 40, 0, 0, 0, 12, 0, 0, 0, 1, 0, 0, 0, 39, 0, 0, 0, 24, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, -112, -79, -63, 0, 0, 0, 0, 0, 37, 0, 0, 0, 12, 0, 0, 0, 1, 0, 0, 0, 37, 0, 0, 0, 12, 0, 0, 0, 8, 0, 0, -128, 59, 0, 0, 0, 8, 0, 0, 0, 27, 0, 0, 0, 16, 0, 0, 0, 57, 0, 0, 0, 40, 0, 0, 0, 88, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, 3, 0, 0, 0, 68, 0, 40, 0, 76, 0, 33, 0, 76, 0, 24, 0, 88, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, 3, 0, 0, 0, 76, 0, 15, 0, 68, 0, 8, 0, 57, 0, 8, 0, 88, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, 3, 0, 0, 0, 47, 0, 8, 0, 38, 0, 15, 0, 38, 0, 24, 0, 88, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, 3, 0, 0, 0, 38, 0, 33, 0, 47, 0, 40, 0, 57, 0, 40, 0, 61, 0, 0, 0, 8, 0, 0, 0, 60, 0, 0, 0, 8, 0, 0, 0, 62, 0, 0, 0, 24, 0, 0, 0, 38, 0, 0, 0, 8, 0, 0, 0, 76, 0, 0, 0, 40, 0, 0, 0, 37, 0, 0, 0, 12, 0, 0, 0, 7, 0, 0, -128, 37, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, -128, 40, 0, 0, 0, 12, 0, 0, 0, 1, 0, 0, 0, 39, 0, 0, 0, 24, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, -112, -79, -63, 0, 0, 0, 0, 0, 37, 0, 0, 0, 12, 0, 0, 0, 1, 0, 0, 0, 37, 0, 0, 0, 12, 0, 0, 0, 8, 0, 0, -128, 59, 0, 0, 0, 8, 0, 0, 0, 27, 0, 0, 0, 16, 0, 0, 0, 73, 0, 0, 0, 27, 0, 0, 0, 88, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, 3, 0, 0, 0, 82, 0, 27, 0, 90, 0, 21, 0, 90, 0, 14, 0, 88, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, 3, 0, 0, 0, 90, 0, 6, 0, 82, 0, 0, 0, 73, 0, 0, 0, 88, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, 3, 0, 0, 0, 64, 0, 0, 0, 57, 0, 6, 0, 57, 0, 14, 0, 88, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, 3, 0, 0, 0, 57, 0, 21, 0, 64, 0, 27, 0, 73, 0, 27, 0, 61, 0, 0, 0, 8, 0, 0, 0, 60, 0, 0, 0, 8, 0, 0, 0, 62, 0, 0, 0, 24, 0, 0, 0, 57, 0, 0, 0, 0, 0, 0, 0, 90, 0, 0, 0, 27, 0, 0, 0, 37, 0, 0, 0, 12, 0, 0, 0, 7, 0, 0, -128, 37,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, 54, 0, 0, 0, 16, 0, 0, 0, 103, 0, 0, 0, -106, 0, 0, 0, 54, 0, 0, 0, 16, 0, 0, 0, 103, 0, 0, 0, 121, 0, 0, 0, 54, 0, 0, 0, 16, 0, 0, 0, 92, 0, 0, 0, 121, 0, 0, 0, 61, 0, 0, 0, 8, 0, 0, 0, 60, 0, 0, 0, 8, 0, 0, 0, 62, 0, 0, 0, 24, 0, 0, 0, 92, 0, 0, 0, 121, 0, 0, 0, 103, 0, 0, 0, -106, 0, 0, 0, 37, 0, 0, 0, 12, 0, 0, 0, 7, 0, 0, -128, 37, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, -128, 40, 0, 0, 0, 12, 0, 0, 0, 1, 0, 0, 0, 14, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 20, 0, 0, 0]

之后,我尝试通过代码将其压缩回来:

    ByteArrayOutputStream baos2 = new ByteArrayOutputStream();
    //Deflater defalter = new Deflater(1);
    DeflaterOutputStream dos = new DeflaterOutputStream(baos2);//deflater, false);
    dos.write(baos.toByteArray(), 0 , baos.toByteArray().length);
    dos.finish();

并得到一个结果:

[120, -100, -67, 84, 77, 47, 3, 81, 20, 61, -29, -85, 45, 13, -29, 91, 89, -48, -108, -78, 32, -77, -112, 72, -22, -93, 105, -126, -46, 40, 9, 43, 105, 44, -112, -120, 5, 34, 44, 36, 86, -70, -112, -40, -118, -123, -75, -60, 47, -16, 15, -8, 23, 126, -116, -124, 51, -45, -5, -30, -103, -52, -68, -63, 98, 94, 114, -46, 119, 122, -49, -36, 123, -49, 25, 106, 1, -88, -29, -5, 92, 17, -49, 26, 95, -74, -127, -101, 1, 96, 108, 117, -77, 12, 88, -80, -37, -127, 7, 126, -33, 68, -16, -118, 83, -47, 61, -75, 2, -73, -51, -64, -121, 5, 20, 45, -4, 56, -5, -81, 9, 44, -66, -73, 96, 25, -25, -72, -60, 17, -97, 89, -59, 38, -54, 94, -83, -101, 72, 19, 73, -23, 103, 107, -49, -91, -124, 91, -126, -88, 122, -38, 87, -17, -16, -43, 123, 69, -29, -34, 39, -119, 33, -71, -69, 103, -29, -20, -50, -5, -100, -48, 52, -22, -50, -35, -22, 11, -78, -29, -120, -12, 76, 73, 78, 115, -62, -81, 2, -8, -70, -58, -73, -120, 67, 31, 95, -45, -8, 56, 113, -32, -29, -114, -58, 123, 2, -8, -119, -58, -35, 125, 46, -120, 37, -39, 115, 81, 62, -117, -30, 51, 37, -49, -85, 61, -107, -73, 4, -67, -87, 59, 79, 125, -54, -112, -47, -3, -53, -37, -97, 50, 114, 49, 67, -20, 18, 83, -38, 123, -7, -108, -61, 63, 23, 100, -88, -56, 114, 82, 22, 99, 70, 93, -106, -101, 100, -24, -38, 38, 76, -70, -124, -105, -116, -69, -75, -71, -97, -21, 46, -63, -39, 54, 17, -106, 25, 36, -25, -84, -8, -120, 35, -77, -100, -44, 77, -69, 79, 83, 49, -117, 81, 98, -48, -88, -101, 101, -57, 105, -2, -41, -28, 8, -109, 110, -104, -11, 70, -78, -26, 126, 61, -100, 57, -52, -39, 57, 34, 44, 51, 55, -81, 118, 111, 118, -61, 71, 28, -103, 21, 100, 103, -45, -18, 43, -84, 84, -7, 38, -85, -100, 100, -46, 85, -47, 69, 109, -110, 61, -109, 70, -99, -61, 122, -98, -38, 124, 68, -65, 60, 103, 58, -84, 22, -120, -80, -52, -14, -62, -85, -46, 39, -114, -52, 42, 114, 55, -19, -66, 67, 69, 13, -3, 68, -89, 81, 87, 67, 27, -75, -115, -98, 38, 93, -55, 123, 87, 109, -124, -71, 95, -127, 51, 75, -100, 93, 33, -62, 50, 43, -56, 115, 53, -15, -15, -97, -52, 56, -18, 79, -103, 101, -120, 71, -4, -4, -115, -10, -13, 107, -115, 103, -124, -121, 121, 80, 117, -43, 39, 14, 15, -114, 111, -25, -7, 0, -82, 123, 112, 34, 60, -88, -70, -22, 19, -121, -121, -78, 111, -25, -19, 0, -82, 123, 40, 71, 120, 80, 117, -43, 39, 14, 15, 123, -66, -99, -113, 3, -72, -18, 97, 47, -62, -125, -86, -85, 62, -65, -15, -48, 73, -12, -55, -2, -74, -36, -65, 0, -108, 74, -2, -44]

当我取消注释 deflater 初始化并在 DeflateOutputStream 构造函数中使用时,获得了更相似的结果。

至于我,这是非常奇怪的行为,或者我没有正确使用充气/放气机制。

任何的想法?

4

1 回答 1

2

无损压缩器,被称为这样,确保压缩后解压缩产生与您开始时完全相同的东西。

另一方面,既没有保证也没有必要保证解压缩后的压缩应该总是产生相同的结果。压缩器可以遵循压缩数据格式,但是根据使用的算法和选择的算法参数,在相同的输入数据上产生非常不同的结果。压缩器通常具有不同的压缩“级别”,允许用户根据应用程序花费更多或更少的 CPU 进行更好或更差的压缩。因此,您将获得具有不同设置的不同输出。

于 2013-05-29T21:17:28.433 回答