이 클래스는 GZIP 파일 형식으로 압축된 데이터를 읽기 위한 스트림 필터를 구현합니다. 생성자
GZIPInputStream(InputStream 입력) :
기본 버퍼 크기로 새 입력 스트림을 만듭니다.
GZIPInputStream(정수 크기의 입력스트림):
지정된 버퍼 크기로 새 입력 스트림을 만듭니다. 방법:
무효 닫기() :
Closes this input stream and releases any system resources associated with the stream.
Syntax : public void close() throws IOException Specified by: close in interface Closeable Specified by: close in interface AutoCloseable Overrides: close in class InflaterInputStream Throws: IOException
int read(byte[] buf int off int len) :
Reads uncompressed data into an array of bytes. If len is not zero the method will block until some input can be decompressed; otherwise no bytes are read and 0 is returned.
Syntax : public int read(byte[] buf int off int len) throws IOException Overrides: read in class InflaterInputStream Parameters: buf - the buffer into which the data is read off - the start offset in the destination array b len - the maximum number of bytes read Returns: the actual number of bytes read or -1 if the end of the compressed input stream is reached Throws: NullPointerException IndexOutOfBoundsException ZipException IOException
클래스 java.util.zip.InflaterInputStream에서 상속된 메소드 사용 가능한 채우기 표시 지원 읽기 재설정 건너뛰기 클래스 java.io.FilterInputStream에서 상속된 메소드 읽다 java.lang.Object 클래스에서 상속된 메소드 복제는 getClass hashCode를 마무리하는 것과 같습니다. informNotifyAll toString 대기 대기 대기 프로그램 : Java
//Java program demonstrating GZipInputStream methods importjava.io.FileInputStream;importjava.io.FileOutputStream;importjava.io.IOException;importjava.util.Arrays;importjava.util.zip.GZIPInputStream;classGZipInputStreamDemo{publicstaticvoidmain(String[]args)throwsIOException{FileInputStreamfis=newFileInputStream('file.txt');GZIPInputStreamgzis=newGZIPInputStream(fis);//Uncompressed FileContents //01234567890 byteb[]=newbyte[10];//skipping 1 byte gzis.skip(1);//illustrating available() and //read(byte b[]int offint len) if(gzis.available()!=-1)gzis.read(b);System.out.println(Arrays.toString(b));//closing the stream gzis.close();}}