public class CompressionSwitchingInputStream
extends java.io.FilterInputStream
Since compression is block-oriented, this is tricky and doesn't support a lot of things (e.g. marking). Also, be aware that just using this and rapidly toggling compression may not actually help, since compression is best done on large amounts of data. Also, compression costs CPU so way the CPU vs. I/O benefit tradeoff, especially for server-side applications.
Copyright 2000-2014 Partner Software, Inc.
| Constructor and Description |
|---|
CompressionSwitchingInputStream(java.io.InputStream in)
Create a new CompressionSwitchingInputStream, wrapping the given input.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
boolean |
isCompressing()
Get whether stream is currently compressing.
|
int |
read() |
int |
read(byte[] b,
int off,
int len) |
void |
setCompressing(boolean tizit)
Set whether stream is currently compressing.
|
public CompressionSwitchingInputStream(java.io.InputStream in)
in - input stream to wrappublic int read()
throws java.io.IOException
read in class java.io.FilterInputStreamjava.io.IOExceptionpublic int read(byte[] b,
int off,
int len)
throws java.io.IOException
read in class java.io.FilterInputStreamjava.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.FilterInputStreamjava.io.IOExceptionpublic boolean isCompressing()
public void setCompressing(boolean tizit)
throws java.io.IOException
tizit - whether to turn on compression or turn it offjava.io.IOException - if it couldn't make the change