Deflater finished() function in Java with examples
The finished() function of the Deflater class in java.util.zip returns true if the end of compression data output stream has been reached.
public boolean finished()
Parameter: The function requires no parameter
Return Type: The function returns boolean value i.e. true if all the input is compressed and stored in the given buffer, else false.
Exception: The function does not throw any exception
Example 1: To demonstrate the use of finished() function
end of compressed data output stream reached :false Compressed String :x?sOM?.N?/r???q?? Size 21 Original String :GeeksforGeeksGeeksforGeeksGeeksforGeeksGeeksforGeeks Size 52 end of compressed data output stream reached :true
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.