Author Topic: Make Serializable  (Read 3319 times)

jnash67

  • Newbie
  • *
  • Posts: 2
    • View Profile
Make Serializable
« on: April 23, 2014, 03:36:34 AM »
I created an in memory ZipFile and wanted to persist it with JPA to some database.  My webapp doesn't have access to the file system.

I had create an extending class of ZipFile called SerializableZipFile:

Code: [Select]
public class SerializableZipFile extends ZipFile implements Serializable {

   public SerializableZipFile(String zipFile) throws ZipException {
      super(zipFile);
   }

   public SerializableZipFile(File zipFile) throws ZipException {
      super(zipFile);
   }
}

Unfortunately, to be able to persist this, the first Non-Serializable parent class must have a no-arg constructor which ZipFile doesn't have.

To make the project Serializable, you would have to provide a no-arg constructor for ZipFile and just have all classes/interfaces implement/extend java.io.Serializable.

There may be a couple of problem classes like ProgressMonitor that cannot be made Serializable (because Thread is not Serializable), but that shouldn't impact the overall ability to Serialize a ZipFile.

MeTaeTer

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Make Serializable
« Reply #1 on: October 01, 2014, 12:48:26 PM »
Wow Wow !!! Amazing . How can you do it? I never see.

Winzzymawin

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • ibcbet link
Re: Make Serializable
« Reply #2 on: January 07, 2015, 10:27:48 AM »
Am interested to read stories like this. Read it and find out.

Vigosstie

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Make Serializable
« Reply #3 on: August 14, 2015, 11:31:16 AM »
Can not believe that people would learn about this, just as I have.

 


Warning: Cannot modify header information - headers already sent in /home/content/66/5374066/html/zip4j/forum/Sources/Errors.php on line 346

Warning: Cannot modify header information - headers already sent in /home/content/66/5374066/html/zip4j/forum/Sources/Errors.php on line 347

Warning: Cannot modify header information - headers already sent in /home/content/66/5374066/html/zip4j/forum/Sources/Errors.php on line 348

Warning: Cannot modify header information - headers already sent in /home/content/66/5374066/html/zip4j/forum/Sources/Errors.php on line 351

Warning: Cannot modify header information - headers already sent in /home/content/66/5374066/html/zip4j/forum/Sources/Errors.php on line 352

Warning: Cannot modify header information - headers already sent in /home/content/66/5374066/html/zip4j/forum/Sources/Errors.php on line 353
Connection Problems

Connection Problems

Sorry, SMF was unable to connect to the database. This may be caused by the server being busy. Please try again later.