فئة Java.util.zip.DeflaterInputStream في Java تطبق هذه الفئة مرشح دفق الإخراج لضغط البيانات بتنسيق الضغط "الانكماش". كما يتم استخدامه كأساس لأنواع أخرى من مرشحات الضغط مثل GZIPOutputStream. البنائين والوصف
DeflaterOutputStream (إخراج OutputStream):
يقوم بإنشاء دفق إخراج جديد باستخدام الضاغط الافتراضي وحجم المخزن المؤقت.
DeflaterOutputStream (OutputStream خارج syncFlush المنطقية):
إنشاء دفق إخراج جديد باستخدام ضاغط افتراضي وحجم مخزن مؤقت افتراضي ووضع التدفق المحدد.
DeflaterOutputStream (OutputStream out Deflater def):
إنشاء دفق إخراج جديد باستخدام الضاغط المحدد وحجم المخزن المؤقت الافتراضي.
DeflaterOutputStream(OutputStream out Deflater def boolean syncFlush):
إنشاء دفق إخراج جديد باستخدام وضع تدفق الضاغط المحدد وحجم المخزن المؤقت الافتراضي.
DeflaterOutputStream (OutputStream out Deflater def int size):
إنشاء دفق إخراج جديد باستخدام الضاغط المحدد وحجم المخزن المؤقت.
DeflaterOutputStream(OutputStream out Deflater def int size boolean syncFlush):
إنشاء دفق إخراج جديد بحجم المخزن المؤقت للضاغط ووضع التدفق المحدد. طُرق:
إغلاق باطل () :
Writes remaining compressed data to the output stream and closes the underlying stream.
Syntax : public void close() throws IOException Overrides: close in class FilterOutputStream Throws: IOException
الفراغ المحمي ينكمش () :
Writes next block of compressed data to the output stream.
Finishes writing compressed data to the output stream without closing the underlying stream.
Syntax : public void finish() throws IOException Throws: IOException
تدفق الفراغ () :
Flushes the compressed output stream.
Syntax : public void flush() throws IOException Overrides: flush in class FilterOutputStream Throws: IOException
الكتابة باطلة (بايت [] ب int off int len):
Writes an array of bytes to the compressed output stream.
Syntax : public void write(byte[] b int off int len) throws IOException Overrides: write in class FilterOutputStream Parameters: b - the data to be written off - the start offset of the data len - the length of the data Throws: IOException
الكتابة الفارغة (int ب):
Writes a byte to the compressed output stream.
Syntax : public void write(int b) throws IOException Overrides: write in class FilterOutputStream Parameters: b - the byte to be written Throws: IOException
Java
//Java program to demonstrate DeflaterOutputStreamimportjava.io.FileInputStream;importjava.io.FileOutputStream;importjava.io.IOException;importjava.util.zip.DeflaterOutputStream;classDeflaterOutputStreamDemo{publicstaticvoidmain(String[]args)throwsIOException{FileOutputStreamfos=newFileOutputStream('file2.txt');//Assign FileOutputStream to DeflaterOutputStreamDeflaterOutputStreamdos=newDeflaterOutputStream(fos);//write it into DeflaterOutputStreamfor(inti=0;i<10;i++){dos.write(i);}//illustrating flush() method()dos.flush();//illustrating finish()//Finishes writing compressed data to the output stream// without closing the underlying streamdos.finish();//fos is not closed//writing some data on filefos.write('G');//Writes remaining compressed data to the output stream// closes the underlying stream.dos.close();}}
ملحوظة: لن يكون مخرج البرنامج مرئيًا على IDE عبر الإنترنت حيث لا يمكن قراءة file2.txt هنا. إنشاء اختبار