Reducing Size of Serialized Object

Does anyone know how to crunch the size of the serialized object? My serialized objects are exceeding 20 megabytes and it's going to cost a lot of bandwidth transfers within our network.
Thanks. :-)

Make any fields transient that you can compute on the other side. If they're still too big after zipping them you may have to use another mechanism other then serialization: extract the minimum necessary data to create the objects and send it over using your own protocol.
I should note that most modems all ready do hardware compression so compressing it yourself may not improve performance much.

Similar Messages

  • Size of serialized Objects

    Hello everybody,
    When I serialize a object to a Byte Array the size of the Byte Array is not exactly the size of the object because of some meta data information. Is there any way there I can predict excatly the size that the Object will have when I serialize it? Of course I known the attributes size of this Object.
    For example if I have an Object X with two attributes Integer A and B with 4 bytes each, I'd like to predict that the Byte Array of this serialized Object wil have 10 bytes (8 for the two attributes and 2 for meta data). Does anybody have an idea?
    Thanks,
    Bruno

    Is
    there any way there I can predict excatly the size
    that the Object will have when I serialize it?Yes. You can serialize it to a byte array, then take the size of that. Then you can send the byte array instead of serializing the original object.
    Basically this is something that's very unlikely to be useful. What are you trying to achieve and why do you think you need to know this information?
    Dave.

  • How to divide big serialized object in parts to be able to save as Blob typ

    Hi,
    Actually i have serialize a big XML document object and want to save in a field of type Blob. As Blob size is 64k. So if the serialized object is greater than 64k. It gives me error of size.Can anybody tell how to break large serialized objects.
    I am using this code
    File f = new File("out.ser");
    FileInputStream fin = new FileInputStream(f);
    p = farCon.prepareStatement("insert into TeeColor values('3',?)");
    p.setBinaryStream(1, fin, f.length());
    p.executeUpdate();
    This code works fine if the size of out.ser file is less than 64k. But does not work for bigger sizes
    Please help me out
    Thanks

    Read your data from the file into a byte array, then extract 64K at a time into a smaller byte array, and use a ByteArrayInputStream for updating the database.

  • Determine the Size of an Object in ObjectInputStream

    Hi all,
    I have a quick question. I have a class that is being written over a socket using ObjectOutputStream and ObjectInputStream. I want to be able to set the buffer size of the socket to fit only ONE object. Can anybody tell me how to determine the size of that object?
    (Note, the object has a Properties object within it, but for the time being, it can be assumed that properties object will always be the same.)
    - Adam

    Having written it to the outputStream, thought, can
    the size be determined somehow by the inputStream?No, it can't
    This is related to my previous question (on Pushlets
    and Thread Priorities). I didn't read that one.
    I believe that it's possible
    that multiple threads are trying to write to the
    socket at the same time, and I cannot synchorize the
    input stream to get a lock on it. Do you mean the outputstream? Why can't you synchronize the method that writes to the outputstream?
    I thought this
    might be causing the data to not be sent over the
    socket until all the threads have finished. That doesn't sound correct. But you could call the flush method when an object is written.
    I
    figured if I reduced the size of the socket buffer,
    it would only accept a single object, eliminating
    this problem?I don't think so.
    /Kaj

  • Have CS5 and CS6.  Need to reduce size of file from 6Mb to 2 Mb for contest purposes without losing original

    Have CS5 and CS6.  Need to reduce size of file from 6Mb to 2 Mb for contest purposes without losing original

    Just save the document to a new jpeg file name using a lower quality setting or re-size the image down in  size the save a high quality smaller new jpeg image.

  • How to reduce size or compress PDF files?

    Hi guys,
    Does someone knows if there is a way  to reduce the size of the PDF file with good quality even on Pictures and Scanned documents? I know the option 'export', 'quartz filter' 'reduce size', but the compression is so extrem. Many files can't not been read, the quality is so bad. Is there a additional app, software or extension that let the user play with the compression on pdf files and let it be more personalized like the dopdf V7 available for windows? i am very dissapointed with this. Please help or suggestion. I will appreciate it. Thanks

    I have used the excellent PDF Toolkit app for a while, and its preformed well. Occassionaly it makes the document into a negative image...which Im noyt sure why...
    Mathishk, im trying your online version out, and am impressed and admire the fact that you have done this.
    Well done. 
    A TRICK i use often. Once all hires images are on the designed document - and its coming in at 15-20mb, just change the link to the images so they are 'missing' then make a pdf.
    i.e 'Hi Res images' to HRes images - old'
    The screen resolution of images is still great, but file comes in at fraction of the size.
    You 'trick' the document to use screen images only. So my 18mb file comes in as 5.2mb.
    Just remember to change the images folder name back, so files relink.
    Andy

  • Only the first page is printed reduced as setup. All pages afterward are full size with information cut off. Recent problem. Can print from Safari just fine. How can I get all pages to be reduced size?

    Question
    Printing internet pages
    Reduced print size
    Only the first page is reduced and printed as desired
    All pages after the first page are full size with information cut off
    Recent problem never seen before
    Can print from Safari and other software just fine
    How can I get all pages to be reduced size?

    One suggestion worked from the Firefox prints incorrectly link mentioned above by mha007. I'm thrilled since this has been annoying me for weeks. Thanks mha007!
    Reset all Firefox printer settings
    # Open your profile folder:
    # On the menu bar, click on the Help menu and select Troubleshooting Information. The Troubleshooting Information tab will open.
    # Under the Application Basics section, click on Show in Finder. A window with your profile folder will open.
    # Note: If you are unable to open or use Firefox, follow the instructions in Finding your profile without opening Firefox.
    # On the menu bar, click on the Firefox menu and select Quit Firefox.
    # In your profile folder, copy the prefs.js file to another folder to make a backup of it.
    # Open the original prefs.js file in a text editor (such as TextEdit).
    # Remove all lines in prefs.js that start with print. and save the file.
    # If something goes wrong when you open Firefox, close it again and overwrite prefs.js with the backup you made.

  • Adobe Acrobat XI pro version, Windows 7, running on iMac parallels, converting pdf to a pdf with reduced size is not possible, error: error in converting the file! What to do? Its a bit annoying not to be able to store pdf files in reduced size, any idea?

    Adobe Acrobat XI pro version, Windows 7, running on iMac parallels, converting pdf to a pdf with reduced size is not possible, error: error in converting the file! What to do? Its a bit annoying not to be able to store pdf files in reduced size, any idea?? Thanks, Jörg

    Hi Jorg ,
    Are you trying to reduce the file size with the "Reduced size PDF" in the save as other option.
    Give it a try if you haven't done it prior.
    Open that PDF>File>Save as Other>Reduced size PDF.
    If possible ,please share the snapshot of the error message with us so that we can have a look in order to assist you further.
    Regards
    Sukrit Dhingra

  • FileUpload problem: InputStream does not contain a serialized object

    Hi All,
    I'm using the FileUpload component in a JSPDynPage and the htmlb component seems to work fine but I cannot read the file (InputStream). I get the following error(IOException): "InputStream does not contain a serialized object".
    Please let me know what is wrong with my code. This is a part of the code I used:
    public FileInputStream sourceFileInput;
    public ObjectInputStream input;
    FileUpload fu;
    fu = (FileUpload) this.getComponentByName("myFileUpload");
    IFileParam fileParam = ((FileUpload) getComponentByName("myFileUpload")).getFile();
    File f       = fileParam.getFile();
    file         = fu.getFile().getFile();
    absolutepath = fu.getFile().getFile().getAbsolutePath();
    this.sourceFileInput = new FileInputStream(file);
    input = new ObjectInputStream(sourceFileInput);
    The last line of code seems to generate te error.

    Hi,
    I have found the answers, thank you both.
    (I included the examle code. Perhaps of some use to someone.)
    FileUpload fu;
    fu = null;
    fu = (FileUpload) this.getComponentByName("myFileUpload");
    //       this is the temporary file
    if (fu != null) {
         IFileParam fileParam = ((FileUpload) getComponentByName("myFileUpload")).getFile();
         if (fileParam != null) {
              // get info about this file and create a FileInputStream
              File f = fileParam.getFile();
              if (f != null) {
                   try {
                        fis = new FileInputStream(f);
                   // process exceptions opening files
                   catch (FileNotFoundException ex) {
                        myBean.setMessage(
                             "1" + f + ex.getLocalizedMessage());
                   isr = new InputStreamReader(fis);
                   br = new BufferedReader(isr);
    String textLine = "";
    do {
         try {
              textLine = (String) br.readLine();
         } catch (IOException e) {
              myBean.setMessage(
                   "1" + e.getLocalizedMessage());
         // Jco append table & put data into the record
         // (I_FILE is the table with txt data that is sent to the RFC)
         I_FILE.appendRow();     
         I_FILE.setValue(textLine, "REC");                              
    } while (textLine != null);

  • StreamCorruptedException: does not contain a serialized object?

    Can someone tell me why am I getting this exception:
    C:\javapr>java FetchObject
    Couldn't retrieve binary data: java.io.StreamCorruptedException: InputStream
    does not contain a serialized object
    java.io.StreamCorruptedException: InputStream does
    not contain a serialized object
    at java.io.ObjectInputStream.readStreamHeader
    (ObjectInputStream.java:849)
    at java.io.ObjectInputStream.<init>
    (ObjectInputStream.java:168)
    at FetchObject.main(FetchObject.java:23)
    import java.sql.*;
    import java.util.*;
    import java.io.*;
    class FetchObject implements Serializable {
        public static void main (String[] args) {
            try {
                String driver = "oracle.jdbc.driver.OracleDriver";
                Class.forName(driver);
                String url = "jdbc:oracle:thin:@mymachine:1521:homedeva";
                Connection conn = DriverManager.getConnection(url,"cnn","cnn");
                FetchObject i = new FetchObject();
                    // Select related
                    try
                         byte[] recdBlob = i.selectBlob( 1 , conn ); 
                         ByteArrayInputStream bytes = new ByteArrayInputStream(recdBlob);
                         ObjectInputStream deserialize = new ObjectInputStream( bytes );
              Employee x = (Employee)deserialize.readObject();
                    catch( Exception ex )
                  System.err.println("Couldn't retrieve binary data: " + ex);
                  ex.printStackTrace();
         catch( Exception ex )
              ex.printStackTrace();
        public byte[] selectBlob( int id, Connection conn )
         byte[] returndata = null;
         try
              Statement stmt = conn.createStatement();
              String sql = "SELECT id, rowdata FROM blobs WHERE id = " + id;
              ResultSet rs = stmt.executeQuery(sql);
              if ( rs.next() )
                           try
                               ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
                               BufferedInputStream bis = new BufferedInputStream( rs.getBinaryStream("rowdata") );
                             byte[] bindata = new byte[4096];
                               int bytesread = 0;
                               if ( !rs.wasNull() )
                                       if ( (bytesread = bis.read(bindata,0,bindata.length)) != -1 )
                                          baos.write(bindata,0,bytesread);
                                returndata = baos.toByteArray();
                             baos.flush();
                                bis.close();
                       catch ( Exception ex )
                            System.err.println("Problem retrieving binary data: " + ex);
                        rs.close();
                         stmt.close();  
               catch ( Exception ex )
                    System.err.println("Couldn't retrieve binary data: " + ex);
            return returndata;
    import java.io.*;
    class Employee implements Serializable
         private String lastName;
         private String firstName;
         public Employee(String lastName, String firstName)
              this.lastName = lastName; 
              this.firstName = firstName;
    }

    To clarify I have stored an Employee Object as a Blob in the Oracle database and am attempting to retreive the
    Employee Object from this Blob.
    Thanks

  • How to change the size of every object in a flash file

    i created a flash website but the problem is the size is to large to fit on screen i have imbeded buttons, Movies clips, masks, and about 7 different scenes in this 13 mb movie what do i do to make the physicle size of the objects on screen so i can view it on my sceen?

    the easiest thing to do would be to load your swf into a main swf and resize the target movieclip (as2) or loader (as3) after loading is complete.

  • Java.io.StreamCorruptedException: InputStream does not contain a serialized object

              I have an applet which calls a JSP to write data object to the db and then the
              JSP sends back the updated data object. The writing part is ok but the response
              is giving the following error. The data object is in a separate class which implements
              Serialized.
              Here's the code in the applet calling the JSP and the response from the JSP
              URL server = null;
              String urlConnectionString = "http://localhost:7001/isLoginValid.jsp";
              try
              server = new URL(urlConnectionString);
              catch(MalformedURLException e)
              System.out.println("URL exception: " + e );
              // send request
              ObjectInputStream response = null;
              Object result = null;
              try
              URLConnection conn = server.openConnection();
              conn.setDoOutput(true);
              conn.setUseCaches(false);
              conn.setRequestProperty("Content-Type", "application/octet-stream");
              ObjectOutputStream request = new ObjectOutputStream(new
              BufferedOutputStream(conn.getOutputStream()));
              request.writeObject((Object)dvo);
              request.flush();
              request.close();
              // get the result input stream
              response = new ObjectInputStream(new BufferedInputStream
              (conn.getInputStream()));
              // read response back from the server
              result = response.readObject();
              if( result!=null && (result instanceof DataVO))
              dvo = (DataVO)result;
              String vo = dvo.printDataVO();
              System.out.println("*DataVO*\n"+vo);
              else
              System.out.println("not an instanceof DataVO");
              catch(IOException ignored)
              System.out.println("Error in DataVO response");
              ignored.printStackTrace();
              Here's the code in the JSP sending the response back to the applet. The 'dvo'
              object is the object which is serialized and has gets and sets for the diff. data
              elements. When I print the 'dvo' before writing the object to outputStream it
              prints the correct values for the data element.
              // send response
              response.setStatus(HttpServletResponse.SC_OK);
              ObjectOutputStream outputStream = new ObjectOutputStream (new BufferedOutputStream
              (response.getOutputStream()));
              outputStream.writeObject(dvo);
              outputStream.flush();
              ERROR is as follows:
              Error in DataVO response
              java.io.StreamCorruptedException: InputStream does not contain a serialized object
              at java/io/ObjectInputStream.readStreamHeader
              at java/io/ObjectInputStream.<init>
              What am I doing wrong?. Please respond soon. The applet is run on IIS and the
              JSP in on weblogic 6.1. I'm not sure if that makes any difference.
              

              I have an applet which calls a JSP to write data object to the db and then the
              JSP sends back the updated data object. The writing part is ok but the response
              is giving the following error. The data object is in a separate class which implements
              Serialized.
              Here's the code in the applet calling the JSP and the response from the JSP
              URL server = null;
              String urlConnectionString = "http://localhost:7001/isLoginValid.jsp";
              try
              server = new URL(urlConnectionString);
              catch(MalformedURLException e)
              System.out.println("URL exception: " + e );
              // send request
              ObjectInputStream response = null;
              Object result = null;
              try
              URLConnection conn = server.openConnection();
              conn.setDoOutput(true);
              conn.setUseCaches(false);
              conn.setRequestProperty("Content-Type", "application/octet-stream");
              ObjectOutputStream request = new ObjectOutputStream(new
              BufferedOutputStream(conn.getOutputStream()));
              request.writeObject((Object)dvo);
              request.flush();
              request.close();
              // get the result input stream
              response = new ObjectInputStream(new BufferedInputStream
              (conn.getInputStream()));
              // read response back from the server
              result = response.readObject();
              if( result!=null && (result instanceof DataVO))
              dvo = (DataVO)result;
              String vo = dvo.printDataVO();
              System.out.println("*DataVO*\n"+vo);
              else
              System.out.println("not an instanceof DataVO");
              catch(IOException ignored)
              System.out.println("Error in DataVO response");
              ignored.printStackTrace();
              Here's the code in the JSP sending the response back to the applet. The 'dvo'
              object is the object which is serialized and has gets and sets for the diff. data
              elements. When I print the 'dvo' before writing the object to outputStream it
              prints the correct values for the data element.
              // send response
              response.setStatus(HttpServletResponse.SC_OK);
              ObjectOutputStream outputStream = new ObjectOutputStream (new BufferedOutputStream
              (response.getOutputStream()));
              outputStream.writeObject(dvo);
              outputStream.flush();
              ERROR is as follows:
              Error in DataVO response
              java.io.StreamCorruptedException: InputStream does not contain a serialized object
              at java/io/ObjectInputStream.readStreamHeader
              at java/io/ObjectInputStream.<init>
              What am I doing wrong?. Please respond soon. The applet is run on IIS and the
              JSP in on weblogic 6.1. I'm not sure if that makes any difference.
              

  • Using Save As Reduced Size PDF in Adobe Acrobat X Pro results in a loss of font.

    We have multiple paged PDF documents (mapbooks created with Esri's ArcMap) that we would like to reduce in size.  When we us the Save As Reduced SIze PDF, the PDF is successfully reduced in size and looks good, except for the fact that starting on page 2, the Times New Roman font is lost and we get a sans-serif font instead (looks like arial).  The first page is always fine and not affected.  It's starting with the second page where the font is lost.  Does anyone have an idea of why that might be happening and how we can use the Reduce File Size feature without losing the font starting on the second page?

    Thanks Bill, that worked after some trial and error.  I was still getting the same problem when I just accepted the default settings for PDF Optimizer.  But I got rid of the problem by creating a Custom setting and turning off the optimization for everything except Image.  And for the Image optimization, I just accepted the defaults.  That took care of the changing fonts problem.  Here is a screenshot of the settings I used (just make sure the check boxes circled are turned off, and only the image compression is turned on):

  • 'Font contains bad/Widths' and 'Cannot find/create font' errors when saving pdf as Other Reduced Size PDF

    I am exporting .indd files from within Indesign as pdf files, opening in Acrobat Pro XI. I have no trouble creating the initial pdf file, however, when I go to Save Other > Reduced Size PDF I get error messages. Depending on the file, I receive either the message, "The font (Myriad Pro) contains bad/Widths" replacing the text with dots or "Cannot find or create the font (Helvetica) Some characters may not print or display properly" replacing text with dots or boxes.
    My confusion is that the file is exporting to pdf from Indesign without error, it is only when I try to Save Other> Reduce Size PDF that the error occurs.
    Also, it is only occurring on five out of 120 pages. These same fonts are on other pages and I have no trouble at all with exporting or Reduce Size PDF.
    More frustrating is that I have never had this problem occur in all my previous versions of Acrobat using the same process and typefaces.
    I am reaching deadline on this and cannot find a solution other than to reload Acrobat 9 and ditch this upgrade.
    Any help would be greatly appreciated.

    I, too have experienced this issue. Upon export from INDD CS6, I see the error message "The font 'IXWIPX+SourceHanSansSC-Bold' contains bad \Widths."
    The only items on the single-page InDesign document I'm trying to export are copies of a one-page PDF (which was extracted from a longer PDF, arranged into a cover format). I can provide all files as necessary. The longer document that the one page came from also experienced an error when I tried to print to Adobe PDF. While I still get a PDF of the cover on export, despite the "bad \widths" message, it won't print from certain machines. I get nothing (not even an empty shell file) from the attempt to print the larger document (where the cover elements came from) to PDF.
    I can deal with these issues with a few unorthodox workarounds, but wanted to offer comments or volunteer to help test fixes if possible.
    For the record, I'm really not enjoying Acrobat XI. It doesn't seem to have much by way of new features (at least not that I use), and some of those I used most in version X are gone or less functional. Common fonts like Times New Roman are often not found (even though they are definitely on my system); I have a much harder time editing text through the new interface, and I have a few other small gripes—some that I don't have time to get into, others that wouldn't really matter, except that they weren't a problem until I "upgraded." Just sayin'.
    Thanks for listening.

  • Acrobat XI Pro crashes when saving as a reduced size PDF in version 11.0.07

    Since upgrading to the v 11.0.7 update, Acrobat XI Pro crashes every time I try to "save as" a reduced size PDF.  I have tried several different settings, but still crashes.

    You might try to setup the page size in the Adobe PDF printer and then print to the printer. I assume you are using PDF Maker (create PDF) and that may be the problem. You might also open the preferences in PDF Maker and turn off most of the options - none should be needed for a single page since you would likely not be using transitions, bookmarks, etc.
    Just as a test, you may want to just start with printing ot the Adobe PDF printer, but you will likely get the default paper size with the PPT shrunk to fit.

Maybe you are looking for