本文整理汇总了Java中java.util.zip.DeflaterInputStream.close方法的典型用法代码示例。如果您正苦于以下问题:Java DeflaterInputStream.close方法的具体用法?Java DeflaterInputStream.close怎么用?Java DeflaterInputStream.close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.zip.DeflaterInputStream
的用法示例。
在下文中一共展示了DeflaterInputStream.close方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testAvailable
import java.util.zip.DeflaterInputStream; //导入方法依赖的package包/类
/**
* @tests DeflaterInputStream#available()
*/
public void testAvailable() throws IOException {
byte[] buf = new byte[1024];
DeflaterInputStream dis = new DeflaterInputStream(is);
assertEquals(1, dis.available());
assertEquals(120, dis.read());
assertEquals(1, dis.available());
assertEquals(22, dis.read(buf, 0, 1024));
assertEquals(1, dis.available());
assertEquals(-1, dis.read());
assertEquals(0, dis.available());
dis.close();
try {
dis.available();
fail("should throw IOException");
} catch (IOException e) {
// expected
}
}
示例2: testRead
import java.util.zip.DeflaterInputStream; //导入方法依赖的package包/类
/**
* @tests DeflaterInputStream#read()
*/
public void testRead() throws IOException {
DeflaterInputStream dis = new DeflaterInputStream(is);
assertEquals(1, dis.available());
assertEquals(120, dis.read());
assertEquals(1, dis.available());
assertEquals(156, dis.read());
assertEquals(1, dis.available());
assertEquals(243, dis.read());
assertEquals(1, dis.available());
dis.close();
try {
dis.read();
fail("should throw IOException");
} catch (IOException e) {
// expected
}
}
示例3: testMark
import java.util.zip.DeflaterInputStream; //导入方法依赖的package包/类
/**
* @tests DeflaterInputStream#mark()
*/
public void testMark() throws IOException {
// mark do nothing
DeflaterInputStream dis = new DeflaterInputStream(is);
dis.mark(-1);
dis.mark(0);
dis.mark(1);
dis.close();
dis.mark(1);
}
示例4: testMarkSupported
import java.util.zip.DeflaterInputStream; //导入方法依赖的package包/类
/**
* @tests DeflaterInputStream#markSupported()
*/
public void testMarkSupported() throws IOException {
DeflaterInputStream dis = new DeflaterInputStream(is);
assertFalse(dis.markSupported());
dis.close();
assertFalse(dis.markSupported());
}