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


Java InflaterOutputStream.close方法代码示例

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


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

示例1: decompressData

import java.util.zip.InflaterOutputStream; //导入方法依赖的package包/类
public static String decompressData(String encdata) {
    try {
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        InflaterOutputStream zos = new InflaterOutputStream(bos);
        zos.write(getdeBASE64inCodec(encdata));
        zos.close();
        return new String(bos.toByteArray());
    } catch (Exception ex) {
        ex.printStackTrace();
        return "UNZIP_ERR";
    }
}
 
开发者ID:wolfboys,项目名称:opencron,代码行数:13,代码来源:DigestUtils.java

示例2: decompressData

import java.util.zip.InflaterOutputStream; //导入方法依赖的package包/类
public static byte[] decompressData(String encdata) throws Exception {
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    InflaterOutputStream zos = new InflaterOutputStream(bos);
    byte[] bs = decryptBASE64(encdata);
    zos.write(bs);
    zos.close();
    return bos.toByteArray();
}
 
开发者ID:junchenChow,项目名称:exciting-app,代码行数:9,代码来源:CryptUtil.java

示例3: deserialize

import java.util.zip.InflaterOutputStream; //导入方法依赖的package包/类
public static TileMap deserialize(JSONObject object) {

        TileMap tileMap = new TileMap(World.WORLD_SIZE, World.WORLD_SIZE);

        byte[] compressedBytes = Base64.getDecoder().decode((String) object.get("z"));

        try {
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            Inflater decompressor = new Inflater(true);
            InflaterOutputStream inflaterOutputStream = new InflaterOutputStream(baos, decompressor);
            inflaterOutputStream.write(compressedBytes);
            inflaterOutputStream.close();

            byte[] terrain = baos.toByteArray();

            for (int x = 0; x < World.WORLD_SIZE; x++) {
                for (int y = 0; y < World.WORLD_SIZE; y++) {
                    tileMap.tiles[x][y] = terrain[x * World.WORLD_SIZE + y];
                }
            }

            return tileMap;


        } catch (IOException e) {
            e.printStackTrace();
        }

        return null;
    }
 
开发者ID:simon987,项目名称:Much-Assembly-Required,代码行数:31,代码来源:TileMap.java

示例4: deserialize

import java.util.zip.InflaterOutputStream; //导入方法依赖的package包/类
public static Memory deserialize(DBObject obj) {

        Memory memory = new Memory(0);

        String zipBytesStr = (String) obj.get("zipBytes");

        if (zipBytesStr != null) {
            byte[] compressedBytes = Base64.getDecoder().decode((String) obj.get("zipBytes"));

            try {
                ByteArrayOutputStream baos = new ByteArrayOutputStream();
                Inflater decompressor = new Inflater(true);
                InflaterOutputStream inflaterOutputStream = new InflaterOutputStream(baos, decompressor);
                inflaterOutputStream.write(compressedBytes);
                inflaterOutputStream.close();

                memory.setBytes(baos.toByteArray());

            } catch (IOException e) {
                e.printStackTrace();
            }
        } else {
            LogManager.LOGGER.severe("Memory was manually deleted");
            memory = new Memory(GameServer.INSTANCE.getConfig().getInt("memory_size"));
        }

        return memory;
    }
 
开发者ID:simon987,项目名称:Much-Assembly-Required,代码行数:29,代码来源:Memory.java

示例5: zlib_decompress

import java.util.zip.InflaterOutputStream; //导入方法依赖的package包/类
public static byte[] zlib_decompress(byte[] encdata,int offset) {
 try {
   ByteArrayOutputStream out = new ByteArrayOutputStream(); 
   InflaterOutputStream inf = new InflaterOutputStream(out); 
   inf.write(encdata,offset, encdata.length-offset); 
   inf.close(); 
   return out.toByteArray(); 
  } catch (Exception ex) {
  	ex.printStackTrace(); 
  	return "ERR".getBytes(); 
  }
}
 
开发者ID:KnIfER,项目名称:mdict-parser-java,代码行数:13,代码来源:mdictRes.java

示例6: zlib_decompress_to_str

import java.util.zip.InflaterOutputStream; //导入方法依赖的package包/类
public static String zlib_decompress_to_str(byte[] encdata,int offset) {
 try {
   ByteArrayOutputStream out = new ByteArrayOutputStream(); 
   InflaterOutputStream inf = new InflaterOutputStream(out); 
   inf.write(encdata,offset, encdata.length-offset); 
   inf.close(); 
   return out.toString("ASCII");
  } catch (Exception ex) {
  	ex.printStackTrace(); 
  	return "ERR"; 
  }
}
 
开发者ID:KnIfER,项目名称:mdict-parser-java,代码行数:13,代码来源:mdict.java

示例7: receiveCompressedMessage

import java.util.zip.InflaterOutputStream; //导入方法依赖的package包/类
private JsonNode receiveCompressedMessage() throws IOException {
    final ByteArrayOutputStream bos = new ByteArrayOutputStream();
    final InflaterOutputStream inflaterOutputStream = new InflaterOutputStream(bos);

    inflaterOutputStream.write(server.getReceivedData());
    inflaterOutputStream.close();

    return new ObjectMapper().readTree(bos.toByteArray());
}
 
开发者ID:osiegmar,项目名称:logback-gelf,代码行数:10,代码来源:GelfUdpAppenderTest.java

示例8: readCompressedData

import java.util.zip.InflaterOutputStream; //导入方法依赖的package包/类
protected void readCompressedData(byte[] readData) throws IOException {
    if (readData.length == originalLength) {
        this.tableData = readData;
        return;
    }

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    InflaterOutputStream compressStream = new InflaterOutputStream(out);
    compressStream.write(readData);
    compressStream.close();

    tableData = out.toByteArray();
}
 
开发者ID:m-abboud,项目名称:FontVerter,代码行数:14,代码来源:Woff1Font.java

示例9: gunzipBytes

import java.util.zip.InflaterOutputStream; //导入方法依赖的package包/类
public static byte[] gunzipBytes(byte[] compressedBytes) throws IOException
{
    ByteArrayOutputStream bos = new ByteArrayOutputStream((int)(compressedBytes.length * 1.5));
    InflaterOutputStream dos = new InflaterOutputStream(bos);
    dos.write(compressedBytes);
    dos.close();
    return bos.toByteArray();
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:9,代码来源:CompressionService.java

示例10: test_close

import java.util.zip.InflaterOutputStream; //导入方法依赖的package包/类
/**
 * @tests java.util.zip.InflaterOutputStream#close()
 */
public void test_close() throws IOException {
    InflaterOutputStream ios = new InflaterOutputStream(os);
    ios.close();
    // multiple close
    ios.close();
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:10,代码来源:InflaterOutputStreamTest.java

示例11: test_write_I_Illegal

import java.util.zip.InflaterOutputStream; //导入方法依赖的package包/类
/**
 * @tests java.util.zip.InflaterOutputStream#write(int)
 */
public void test_write_I_Illegal() throws IOException {

    // write after close
    InflaterOutputStream ios = new InflaterOutputStream(os);
    ios.close();
    try {
        ios.write(-1);
        fail("Should throw IOException");
    } catch (IOException e) {
        // expected
    }
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:16,代码来源:InflaterOutputStreamTest.java

示例12: decompress

import java.util.zip.InflaterOutputStream; //导入方法依赖的package包/类
@Override
public byte[] decompress(final byte[] data) {
  if (data == null) {
    return null;
  }

  final ByteArrayOutputStream buffer = new ByteArrayOutputStream(data.length);
  final InflaterOutputStream inflaterStream = new InflaterOutputStream(buffer, new Inflater());

  try {
    inflaterStream.write(data);
    inflaterStream.close();
    buffer.close();
  } catch (final IOException e) {
    throw new RuntimeException("failed compressing using deflate", e);
  }

  return buffer.toByteArray();
}
 
开发者ID:outbrain,项目名称:ob1k,代码行数:20,代码来源:DeflateCompressor.java

示例13: inflate

import java.util.zip.InflaterOutputStream; //导入方法依赖的package包/类
private static final byte[] inflate(byte[] data, boolean raw) {
    try {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        InflaterOutputStream inflaterOut = new InflaterOutputStream(baos, new Inflater(raw));
        inflaterOut.write(data);
        inflaterOut.close();
        return baos.toByteArray();
    }
    catch(Exception e) {
        throw Throwables.propagate(e);
    }
}
 
开发者ID:wotifgroup,项目名称:jopfli,代码行数:13,代码来源:JopfliDeflaterTests.java

示例14: getDocument

import java.util.zip.InflaterOutputStream; //导入方法依赖的package包/类
public byte[] getDocument(final DocumentInfo metadata) throws IOException {
    final Map<String, String> pointer = this.index.getFilePosition(metadata);
    final byte[] buffer = this.readAndDecrypt(pointer.get("f"));
    final int offset = Integer.parseInt(pointer.get("o"));
    final int size = Integer.parseInt(pointer.get("s"));

    final ByteArrayOutputStream result = new ByteArrayOutputStream();
    final InflaterOutputStream inflate = new InflaterOutputStream(result);
    inflate.write(buffer, offset, size);
    inflate.close();

    return result.toByteArray();
}
 
开发者ID:tobiasbaum,项目名称:portalsammler,代码行数:14,代码来源:SecureStore.java


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