Free Support Forum - groupdocs.com

FileData is not serializable

Hi,

we want to store file Information in a database. therefore we implemented IFileDataStore. But when serializing

com.groupdocs.viewer.domain.FileData, a NotSerializableException is thrown from PageData. Would it be possible to make all child elements of FileData Serializable at the next release?

Hi There,


Thanks for showing interest in GroupDocs.Viewer for Java and posting your query.
Can you please tell us, which version of the API you are integrating in your project or evaluating ?

Thanks

Hi, we use java 3.2.2

Hi There,


Thanks for the prompt reply.
Can you please also provide us your sample project or code snippet?
Keen to hear from you.

Kind regards

Hi,

here’s a code snippet:



@Override

public void saveFileData(FileDescription description, FileData filedata) {



ByteArrayOutputStream bos = new ByteArrayOutputStream();

ObjectOutputStream out = null;

byte[] databytes = null;

try {

out = new ObjectOutputStream(bos);

out.writeObject(filedata);

out.flush();

databytes = bos.toByteArray();

} catch(Exception e){

logger.addError(“saveFileData”, e.getMessage());

}



data.put(description.getGuid(), databytes);

}



Kind regards

Hi There,


We appreciate your cooperation.
We have logged your issue in our internal issue tracking system with ID:VIEWERJAVA-1311. As we get any update from the concerned team, we shall notify you.

Best wishes

Hi There,


We would like to inform you that FileData child elements are not Serializable in the current version of the API. We shall make all FileData child elements Serializable in some next release of the API. But at the moment, we cannot tell you about the release version in which we’ll fix it. However, we have a workaround for you. Please try serialize\deserialize methods from this sample FileDataStore class and let us know about your experience.

Best Wishes