logo

Јава.утил.зип.ГЗИПИнпутСтреам класа у Јави

Ова класа имплементира филтер тока за читање компресованих података у ГЗИП формату датотеке. Конструктори
    ГЗИПИнпутСтреам(ИнпутСтреам ин) :Креира нови улазни ток са подразумеваном величином бафера. ГЗИПИнпутСтреам(ИнпутСтреам у величини инт) :Креира нови улазни ток са наведеном величином бафера.
Методе:
    воид цлосе(): 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 
    инт реад(бите[] буф инт офф инт лен) : 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
  //Java program demonstrating GZipInputStream methods  import java.io.FileInputStream;  import java.io.FileOutputStream;  import java.io.IOException;  import java.util.Arrays; import java.util.zip.GZIPInputStream;  class GZipInputStreamDemo  {   public static void main(String[] args) throws IOException   {   FileInputStream fis = new FileInputStream('file.txt');   GZIPInputStream gzis = new GZIPInputStream(fis);     //Uncompressed FileContents   //01234567890   byte b[]=new byte[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();   }  }  
Излаз :
[1 2 3 4 5 6 7 8 9 0]
Креирај квиз