当前位置: 首页>>代码示例>>Java>>正文


Java DataFormatException.printStackTrace方法代码示例

本文整理汇总了Java中java.util.zip.DataFormatException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java DataFormatException.printStackTrace方法的具体用法?Java DataFormatException.printStackTrace怎么用?Java DataFormatException.printStackTrace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.zip.DataFormatException的用法示例。


在下文中一共展示了DataFormatException.printStackTrace方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: decode

import java.util.zip.DataFormatException; //导入方法依赖的package包/类
@Override
public void decode() {
    if (buffer().readableBytes() < 2) return;

    try {
        setBuffer(Compression.inflate(buffer()));
    } catch (DataFormatException e) {
        e.printStackTrace();
        return;
    }

    if (buffer().readableBytes() == 0) {
        throw new RuntimeException("Decoded BatchPacket payload is empty");
    }

    buffer().readerIndex(2);
    while (buffer().readerIndex() < buffer().readableBytes()) {
        PacketRegistry.handlePacket(new RakNetPacket(readBytes()), getPlayer());
    }
}
 
开发者ID:KernelFreeze,项目名称:BedrockProxy,代码行数:21,代码来源:BatchPacket.java

示例2: uncompress

import java.util.zip.DataFormatException; //导入方法依赖的package包/类
public static byte[] uncompress(byte[] input) {
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    Inflater decompressor = new Inflater();
    try {
        decompressor.setInput(input);
        final byte[] buf = new byte[2048];
        while (!decompressor.finished()) {
            int count = 0;
            try {
                count = decompressor.inflate(buf);
            } catch (DataFormatException e) {
                e.printStackTrace();
            }
            bos.write(buf, 0, count);
        }
    } finally {
        decompressor.end();
    }
    return bos.toByteArray();
}
 
开发者ID:hoangkien0705,项目名称:Android-UtilCode,代码行数:21,代码来源:LogUtils.java

示例3: uncompress

import java.util.zip.DataFormatException; //导入方法依赖的package包/类
@Override
public byte[] uncompress(byte[] data) throws IOException {
	ByteArrayOutputStream bos = new ByteArrayOutputStream();
	Inflater decompressor = new Inflater();
	
	try {
		decompressor.setInput(data);
		final byte[] buf = new byte[2048];
		while (!decompressor.finished()) {
			int count = decompressor.inflate(buf);
			bos.write(buf, 0, count);
		}
	} catch (DataFormatException e) {
		e.printStackTrace();
	} finally {
		decompressor.end();
	}
	
	return bos.toByteArray();
}
 
开发者ID:yu120,项目名称:compress,代码行数:21,代码来源:DeflaterCompress.java

示例4: uncompress

import java.util.zip.DataFormatException; //导入方法依赖的package包/类
public static byte[] uncompress(final byte[] input) {
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    Inflater decompressor = new Inflater();
    try {
        decompressor.setInput(input);
        final byte[] buf = new byte[2048];
        while (!decompressor.finished()) {
            int count = 0;
            try {
                count = decompressor.inflate(buf);
            } catch (DataFormatException e) {
                e.printStackTrace();
            }
            bos.write(buf, 0, count);
        }
    } finally {
        decompressor.end();
    }
    return bos.toByteArray();
}
 
开发者ID:Wilshion,项目名称:HeadlineNews,代码行数:21,代码来源:LogUtils.java

示例5: decompressForZlib

import java.util.zip.DataFormatException; //导入方法依赖的package包/类
/**
 * zlib decompress 2 byte
 *
 * @param bytesToDecompress
 * @return
 */
public static byte[] decompressForZlib(byte[] bytesToDecompress) {
    byte[] returnValues = null;

    Inflater inflater = new Inflater();

    int numberOfBytesToDecompress = bytesToDecompress.length;

    inflater.setInput(bytesToDecompress, 0, numberOfBytesToDecompress);

    int numberOfBytesDecompressedSoFar = 0;
    List<Byte> bytesDecompressedSoFar = new ArrayList<>();

    try {
        while (!inflater.needsInput()) {
            byte[] bytesDecompressedBuffer = new byte[numberOfBytesToDecompress];

            int numberOfBytesDecompressedThisTime = inflater.inflate(bytesDecompressedBuffer);

            numberOfBytesDecompressedSoFar += numberOfBytesDecompressedThisTime;

            for (int b = 0; b < numberOfBytesDecompressedThisTime; b++) {
                bytesDecompressedSoFar.add(bytesDecompressedBuffer[b]);
            }
        }

        returnValues = new byte[bytesDecompressedSoFar.size()];
        for (int b = 0; b < returnValues.length; b++) {
            returnValues[b] = (byte) (bytesDecompressedSoFar.get(b));
        }

    } catch (DataFormatException dfe) {
        dfe.printStackTrace();
    }

    inflater.end();
    return returnValues;
}
 
开发者ID:goutham106,项目名称:GmArchMvvm,代码行数:44,代码来源:ZipHelper.java

示例6: decompressForZlib

import java.util.zip.DataFormatException; //导入方法依赖的package包/类
/**
 * zlib decompress 2 byte
 *
 * @param bytesToDecompress byte[]
 * @return byte[]
 */
public static byte[] decompressForZlib(byte[] bytesToDecompress) {
    byte[] returnValues = null;

    Inflater inflater = new Inflater();

    int numberOfBytesToDecompress = bytesToDecompress.length;

    inflater.setInput(bytesToDecompress, 0, numberOfBytesToDecompress);

    int numberOfBytesDecompressedSoFar = 0;
    List<Byte> bytesDecompressedSoFar = new ArrayList<>();

    try {
        while (!inflater.needsInput()) {
            byte[] bytesDecompressedBuffer = new byte[numberOfBytesToDecompress];

            int numberOfBytesDecompressedThisTime = inflater.inflate(bytesDecompressedBuffer);

            numberOfBytesDecompressedSoFar += numberOfBytesDecompressedThisTime;

            for (int b = 0; b < numberOfBytesDecompressedThisTime; b++) {
                bytesDecompressedSoFar.add(bytesDecompressedBuffer[b]);
            }
        }

        returnValues = new byte[bytesDecompressedSoFar.size()];
        for (int b = 0; b < returnValues.length; b++) {
            returnValues[b] = (byte) (bytesDecompressedSoFar.get(b));
        }

    } catch (DataFormatException dfe) {
        dfe.printStackTrace();
    }

    inflater.end();
    return returnValues;
}
 
开发者ID:xiaobailong24,项目名称:MVVMArms,代码行数:44,代码来源:ZipHelper.java

示例7: decompressForZlib

import java.util.zip.DataFormatException; //导入方法依赖的package包/类
/**
 * zlib decompress 2 byte
 *
 * @param bytesToDecompress
 * @return
 */
public static byte[] decompressForZlib(byte[] bytesToDecompress) {
    byte[] returnValues = null;

    Inflater inflater = new Inflater();

    int numberOfBytesToDecompress = bytesToDecompress.length;

    inflater.setInput
            (
                    bytesToDecompress,
                    0,
                    numberOfBytesToDecompress
            );

    int bufferSizeInBytes = numberOfBytesToDecompress;

    int numberOfBytesDecompressedSoFar = 0;
    List<Byte> bytesDecompressedSoFar = new ArrayList<Byte>();

    try {
        while (inflater.needsInput() == false) {
            byte[] bytesDecompressedBuffer = new byte[bufferSizeInBytes];

            int numberOfBytesDecompressedThisTime = inflater.inflate
                    (
                            bytesDecompressedBuffer
                    );

            numberOfBytesDecompressedSoFar += numberOfBytesDecompressedThisTime;

            for (int b = 0; b < numberOfBytesDecompressedThisTime; b++) {
                bytesDecompressedSoFar.add(bytesDecompressedBuffer[b]);
            }
        }

        returnValues = new byte[bytesDecompressedSoFar.size()];
        for (int b = 0; b < returnValues.length; b++) {
            returnValues[b] = (byte) (bytesDecompressedSoFar.get(b));
        }

    } catch (DataFormatException dfe) {
        dfe.printStackTrace();
    }

    inflater.end();

    return returnValues;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:55,代码来源:ZipHelper.java

示例8: decompressForZlib

import java.util.zip.DataFormatException; //导入方法依赖的package包/类
/**
 * zlib decompress 2 byte
 *
 * @param bytesToDecompress
 * @return
 */
public static byte[] decompressForZlib(byte[] bytesToDecompress) {
    byte[] returnValues = null;

    Inflater inflater = new Inflater();

    int numberOfBytesToDecompress = bytesToDecompress.length;

    inflater.setInput
            (bytesToDecompress, 0, numberOfBytesToDecompress);

    int bufferSizeInBytes = numberOfBytesToDecompress;

    int numberOfBytesDecompressedSoFar = 0;
    List<Byte> bytesDecompressedSoFar = new ArrayList<Byte>();

    try {
        while (inflater.needsInput() == false) {
            byte[] bytesDecompressedBuffer = new byte[bufferSizeInBytes];

            int numberOfBytesDecompressedThisTime = inflater.inflate(bytesDecompressedBuffer);

            numberOfBytesDecompressedSoFar += numberOfBytesDecompressedThisTime;

            for (int b = 0; b < numberOfBytesDecompressedThisTime; b++) {
                bytesDecompressedSoFar.add(bytesDecompressedBuffer[b]);
            }
        }

        returnValues = new byte[bytesDecompressedSoFar.size()];
        for (int b = 0; b < returnValues.length; b++) {
            returnValues[b] = (byte) (bytesDecompressedSoFar.get(b));
        }

    } catch (DataFormatException dfe) {
        dfe.printStackTrace();
    }

    inflater.end();

    return returnValues;
}
 
开发者ID:RockyQu,项目名称:MVVMFrames,代码行数:48,代码来源:ZipUtils.java

示例9: decompressForZlib

import java.util.zip.DataFormatException; //导入方法依赖的package包/类
/**
 * zlib decompress 2 byte
 *
 * @param bytesToDecompress
 * @return
 */
public static byte[] decompressForZlib(byte[] bytesToDecompress) {
    byte[] returnValues = null;

    Inflater inflater = new Inflater();
    int numberOfBytesToDecompress = bytesToDecompress.length;

    inflater.setInput(
            bytesToDecompress,
            0,
            numberOfBytesToDecompress);

    int bufferSizeInBytes = numberOfBytesToDecompress;

    int numberOfBytesDecompressedSoFar = 0;
    List<Byte> bytesDecompressedSoFar = new ArrayList<Byte>();

    try {
        while (inflater.needsInput() == false) {
            byte[] bytesDecompressedBuffer = new byte[bufferSizeInBytes];

            int numberOfBytesDecompressedThisTime = inflater.inflate(
                    bytesDecompressedBuffer);

            numberOfBytesDecompressedSoFar += numberOfBytesDecompressedThisTime;

            for (int b = 0; b < numberOfBytesDecompressedThisTime; b++) {
                bytesDecompressedSoFar.add(bytesDecompressedBuffer[b]);
            }
        }

        returnValues = new byte[bytesDecompressedSoFar.size()];
        for (int b = 0; b < returnValues.length; b++) {
            returnValues[b] = (byte) (bytesDecompressedSoFar.get(b));
        }

    } catch (DataFormatException dfe) {
        dfe.printStackTrace();
    }

    inflater.end();

    return returnValues;
}
 
开发者ID:Wan7451,项目名称:mvparms,代码行数:50,代码来源:ZipHelper.java


注:本文中的java.util.zip.DataFormatException.printStackTrace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。