|
JavaTM Platform Standard Ed. 6 |
|||||||||
| 앞의 클래스 다음의 클래스 | 프레임 있어 프레임 없음 | |||||||||
| 개요: 상자 | 필드 | 생성자 | 메소드 | 상세: 필드 | 생성자 | 메소드 | |||||||||
java.lang.Objectjava.util.zip.Inflater
public class Inflater
이 클래스는, 일반적인 ZLIB 압축 라이브러리를 사용해 범용의 압축 해제를 지원합니다. ZLIB 압축 라이브러리는, 당초 PNG 그래픽 표준의 일부로서 개발된 것으로, 특허로는 보호되고 있지 않습니다. 스펙의 자세한 것은,「패키지 java.util.zip 의 설명」을 참조해 주세요.
다음에,Deflater 및 Inflater 를 사용해 캐릭터 라인을 얼마인가 압축 및 압축 해제하는 코드를 나타냅니다.
try {
// Encode a String into bytes
String inputString = "blahblahblah??";
byte[] input = inputString.getBytes("UTF-8");
// Compress the bytes
byte[] output = new byte[100];
Deflater compresser = new Deflater();
compresser.setInput(input);
compresser.finish();
int compressedDataLength = compresser.deflate(output);
// Decompress the bytes
Inflater decompresser = new Inflater();
decompresser.setInput(output, 0, compressedDataLength);
byte[] result = new byte[100];
int resultLength = decompresser.inflate(result);
decompresser.end();
// Decode the bytes into a String
String outputString = new String(result, 0, resultLength, "UTF-8");
} catch(java.io.UnsupportedEncodingException ex) {
// handle
} catch (java.util.zip.DataFormatException ex) {
// handle
}
Deflater | 생성자 의 개요 | |
|---|---|
Inflater ()
새로운 디컴프레서를 작성합니다. |
|
Inflater (boolean nowrap)
새로운 디컴프레서를 작성합니다. |
|
| 메소드의 개요 | |
|---|---|
void |
end ()
디컴프레서를 닫아 압축 해제된 입력을 모두 파기합니다. |
protected void |
finalize ()
가베지 컬렉션을 했을 때에 디컴프레서를 닫습니다. |
boolean |
finished ()
압축 데이터 스트림의 마지막에 달했을 경우에 true 를 돌려줍니다. |
int |
getAdler ()
압축 해제 데이터의 ADLER-32 치를 돌려줍니다. |
long |
getBytesRead ()
지금까지 입력된, 압축된 바이트의 총수를 돌려줍니다. |
long |
getBytesWritten ()
지금까지 출력된, 압축 해제된 바이트의 총수를 돌려줍니다. |
int |
getRemaining ()
입력 버퍼에 남아 있는 바이트의 총수를 돌려줍니다. |
int |
getTotalIn ()
지금까지 입력된, 압축된 바이트의 총수를 돌려줍니다. |
int |
getTotalOut ()
지금까지 출력된, 압축 해제된 바이트의 총수를 돌려줍니다. |
int |
inflate (byte[] b)
지정된 버퍼에 바이트를 압축 해제합니다. |
int |
inflate (byte[] b,
int off,
int len)
지정된 버퍼에 바이트를 압축 해제합니다. |
boolean |
needsDictionary ()
pre-set 사전가 압축 해제에 필요한 경우에 true 를 돌려줍니다. |
boolean |
needsInput ()
입력 버퍼에 데이터가 남지 않은 경우에 true 를 돌려줍니다. |
void |
reset ()
새로운 입력 데이터 세트를 처리할 수 있도록(듯이) 인플레이터를 리셋 합니다. |
void |
setDictionary (byte[] b)
pre-set 사전를 지정의 바이트 배열로 설정합니다. |
void |
setDictionary (byte[] b,
int off,
int len)
pre-set 사전를 지정의 바이트 배열로 설정합니다. |
void |
setInput (byte[] b)
압축 해제를 위한 입력 데이터를 설정합니다. |
void |
setInput (byte[] b,
int off,
int len)
압축 해제를 위한 입력 데이터를 설정합니다. |
| 클래스 java.lang. Object 로부터 상속된 메소드 |
|---|
clone , equals , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait |
| 생성자 의 상세 |
|---|
public Inflater(boolean nowrap)
주:nowrap 옵션을 사용하는 경우는, 입력으로서 특별한 「더미」바이트를 지정할 필요가 있습니다. 이것은, 최적화를 실시하기 위해서(때문에) ZLIB 네이티브 라이브러리에서 필요합니다.
nowrap - true 의 경우는 GZIP 호환의 압축을 지원public Inflater()
| 메소드의 상세 |
|---|
public void setInput(byte[] b,
int off,
int len)
b - 입력 데이터 바이트off - 입력 데이터의 개시 오프셋(offset)len - 입력 데이터의 길이needsInput() public void setInput(byte[] b)
b - 입력 데이터 바이트needsInput()
public void setDictionary(byte[] b,
int off,
int len)
b - 사전 데이터 바이트off - 데이터의 개시 오프셋(offset)len - 데이터의 길이needsDictionary() ,
getAdler() public void setDictionary(byte[] b)
b - 사전 데이터 바이트needsDictionary() ,
getAdler() public int getRemaining()
public boolean needsInput()
public boolean needsDictionary()
setDictionary(byte[], int, int) public boolean finished()
public int inflate(byte[] b,
int off,
int len)
throws DataFormatException
b - 압축 해제되는 데이터용의 버퍼off - 데이터의 개시 오프셋(offset)len - 압축 해제되는 최대 바이트수
DataFormatException - 압축 데이터 형식이 무효인 경우needsInput() ,
needsDictionary()
public int inflate(byte[] b)
throws DataFormatException
b - 압축 해제되는 데이터용의 버퍼
DataFormatException - 압축 데이터 형식이 무효인 경우needsInput() ,
needsDictionary() public int getAdler()
public int getTotalIn()
바이트수는 Integer.MAX_VALUE 보다 커지는 경우가 있기 (위해)때문에, 이 정보를 얻는 경우는 getBytesRead() 메소드의 (분)편을 우선적으로 사용해 주세요.
public long getBytesRead()
public int getTotalOut()
바이트수는 Integer.MAX_VALUE 보다 커지는 경우가 있기 (위해)때문에, 이 정보를 얻는 경우는 getBytesWritten() 메소드의 (분)편을 우선적으로 사용해 주세요.
public long getBytesWritten()
public void reset()
public void end()
protected void finalize()
Object 내의 finalize
|
JavaTM Platform Standard Ed. 6 |
|||||||||
| 앞의 클래스 다음의 클래스 | 프레임 있어 프레임 없음 | |||||||||
| 개요: 상자 | 필드 | 생성자 | 메소드 | 상세: 필드 | 생성자 | 메소드 | |||||||||
Copyright 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms . Documentation Redistribution Policy 도 참조해 주세요.