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

Similar Messages

  • How do I determine the size of an object on a particular layer?

    Whether it's a rectangle, circle, line, etc. how do I determine what the size of an object is on a particular layer?

    Right click on the rulers and set the scale to pixels in the dialog
    Go to View>new guide and select the position of the guide lines along horizontal and vertial axes
    Window>info brings up the Info Palette. The information in the right lower corner provides a readout of any selection that you make, e.g. with the marquee tool
    View>grid allows one to bring up a non-printable grid which is useful for orientation. The grid can be set up with subdivisions to suit via Edit>preferences>guides and grid
    You can open a duplicate layer at the top of the stack, then using the brush tool create a straight line for visual projection. The layer can be deleted at any time. To create a straight line, click on the begin point, hold down the shift key, and click on the end point
    Hope that one of these options is useful for your purpose. Please post your progress.

  • How do I determine the size of an object?

    After an object is instantiated, is there anyway to determine its size (in bytes)?

    Why do you want to know? Java handles memory management for you.
    IIRC for Sun JVM 1.4:
    Objects: four bytes for each reference, boolean, byte, short, int, float or character field, eight bytes for each long or double field, plus sixteen bytes header information.
    Arrays: length * (four for reference, int or float; one for boolean or byte; two for short or character; eightfor long or double), plus sixteen bytes header information.
    Pete

  • How Can I Determine the Size of the 'My Documents' Folder for every user on a local machine using VBScript?

    Hello,
    I am at my wits end into this. Either I am doing it the wrong way or it is not possible.
    Let me explain. I need a vb script for the following scenario:
    1. The script is to run on multiple Windows 7 machines (32-Bit & 64-Bit alike).
    2. These are shared workstation i.e. different users login to these machines from time to time.
    3. The objective of this script is to traverse through each User Profile folder and get the size of the 'My Documents' folder within each User Profile folder. This information is to be written to a
    .CSV file located at C:\Temp directory on the machine.
    4. This script would be pushed to all workstations from SCCM. It would be configured to execute with
    System Rights
    I tried the script detailed at:
    http://blogs.technet.com/b/heyscriptingguy/archive/2005/03/31/how-can-i-determine-the-size-of-the-my-documents-folder.aspx 
    Const MY_DOCUMENTS = &H5&
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objShell = CreateObject("Shell.Application")
    Set objFolder = objShell.Namespace(MY_DOCUMENTS)
    Set objFolderItem = objFolder.Self
    strPath = objFolderItem.Path
    Set objFolder = objFSO.GetFolder(strPath)
    Wscript.Echo objFolder.Size
    The Wscript.Echo objFolder.Size command in the script at the above mentioned link returned the value as
    '0' (zero) for the current logged on user. Although the actual size was like 30 MB or so.
    I then tried the script at:
    http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_27869829.html
    This script returns the correct value but only for the current logged-on user.
    Const blnShowErrors = False
    ' Set up filesystem object for usage
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objShell = CreateObject("WScript.Shell")
    ' Display desired folder sizes
    Wscript.Echo "MyDocuments : " & FormatSize(FindFiles(objFSO.GetFolder(objShell.SpecialFolders("MyDocuments"))))
    ' Recursively tally the size of all files under a folder
    ' Protect against folders or files that are not accessible
    Function FindFiles(objFolder)
    On Error Resume Next
    ' List files
    For Each objFile In objFolder.Files
    On Error Resume Next
    If Err.Number <> 0 Then ShowError "FindFiles:01", objFolder.Path
    On Error Resume Next
    FindFiles = FindFiles + objFile.Size
    If Err.Number <> 0 Then ShowError "FindFiles:02", objFile.Path
    Next
    If Err.Number = 0 Then
    ' Recursively drill down into subfolder
    For Each objSubFolder In objFolder.SubFolders
    On Error Resume Next
    If Err.Number <> 0 Then ShowError "FindFiles:04", objFolder.Path
    FindFiles = FindFiles + FindFiles(objSubFolder)
    If Err.Number <> 0 Then ShowError "FindFiles:05", objSubFolder.Path
    Next
    Else
    ShowError "FindFiles:03", objFolder.Path
    End If
    End Function
    ' Function to format a number into typical size scales
    Function FormatSize(iSize)
    aLabel = Array("bytes", "KB", "MB", "GB", "TB")
    For i = 0 to 4
    If iSize > 1024 Then iSize = iSize / 1024 Else Exit For End If
    Next
    FormatSize = Round(iSize, 2) & " " & aLabel(i)
    End Function
    Sub ShowError(strLocation, strMessage)
    If blnShowErrors Then
    WScript.StdErr.WriteLine "==> ERROR at [" & strLocation & "]"
    WScript.StdErr.WriteLine " Number:[" & Err.Number & "], Source:[" & Err.Source & "], Desc:[" & Err.Description & "]"
    WScript.StdErr.WriteLine " " & strMessage
    Err.Clear
    End If
    End Sub
    The only part pending, is to achieve this for the 'My Documents' folder within each User Profile folder.
    Is this possible?
    Please help.

    Here are a bunch of scripts to get folder size under all circumstances.  Take your pick.
    https://gallery.technet.microsoft.com/scriptcenter/site/search?query=get%20folder%20size&f%5B0%5D.Value=get%20folder%20size&f%5B0%5D.Type=SearchText&ac=2
    ¯\_(ツ)_/¯

  • How to determine the size of an InputStream??

    Hello,
    I need to get the size of an inputstream. In fact, I am working with java.nio.channels and need to tranfer a file from within a Jar to the FileSystem.
    I have created a ReadableByteChannel from the jar resource, and a FileChannel from the FileSystem destination. The problem is that to use the FileChannel .tranferFrom(..) I need the size of the src file. But, ReadableByteChannel has no size() method.
    How can I determine the size of this InputStream??
    advanced Thanx
    here is code:
    private void copyResourcesToFileSystem(){
              try{
                        String name = getFileName(); // gets the name
                        ReadableByteChannel srcChannel =
                             Channels.newChannel(this.getClass().getClassLoader().getResourceAsStream(("dtd/"+name)));
                        File newFile = new File(TempDirCreator.getXmlDir(),name);
                        FileChannel dstChannel = new FileOutputStream(newFile).getChannel();
                        dstChannel.transferFrom(srcChannel, 0, srcChannel.size());  // doesn't work -- there is no ReadableBC.size()
                        // lets close the show
                        srcChannel.close();
                        dstChannel.close();
              }catch(IOException x){x.printStackTrace();}
              catch(Exception ex){ex.printStackTrace();}
         }

    In general the "size of an InputStream" is a meaningless concept. It's possible to have an InputStream that never terminates. So if you can't get a size from whatever you're reading from, you're out of luck.
    I missed where you explained why you need the size. I've never felt the need to know how many bytes would be passing through my code when copying from input to output.

  • How to determine the size (in pixels) of the current mode

    Hello.
    I am looking for a was to determine the size (horizontal and vertical pixels) of the current mode (SAPGUI window). I have already looked through the methods provided by class CL_GUI_CFW...
    CL_GUI_CFW=>GET_METRIC_FACTORS provides the size of you display (i.e. 1600 x 1200 pixels) and some other information I am not able to interprete.
    Futhermore I have had a look at the Methods CL_GUI_CFW=>COMPUTEPIXEL, but I don´t know how to use them.
    Has anybody of you any experiences in this topic? I would be grateful ...
    MIKE

    Sorry Manoj,
    but i didn´t find out, why these programs should be able to solve my issue. They just display a picture using the CL_GUI_PICTURE control.
    I am looking fo a way to resize a given control to the very maximum, so that it fills the whole SAPGUI window!
    Thanks anyway...
    MIKE

  • Determining the size of an Image

    I am running Pages 5.2 and I have a document with a whole load of images taken from photos. Usually I shrink the original images to keep the document size manageable but I forgot on some but I don't know which. Is there a way I can determine the size of individual images in the document ?

    In Pages v5.2, there does not appear any means to assess the image storage size, but File > Reduce File Size will offer a prompt stating an amount it can reduce the current selected image.
    Another approach is to select the image, and press command+C to put it on the clipboard. Launch Preview, ignore the open dialog, and choose File > New from Clipboard. You now have two choices to assess image size: 1) Use the Inspector (General Info panel) from the toolbar, or 2) Menu > Tools > Adjust Size...

  • How do I determine the size of an event (cmd I does not show any size for events).

    How do I determine the size of an Event in iPhoto? (Cmd + I does not show size information at the event level).

    If you're running iPhoto 8 (09) select the event and look at the Info pane at the lower left hand corner of the window.  It will give you the number of photos and size:
    for iPhoto 9 (11) open the Event, select all of the photos in it and open the Info drawer at the right by typing Command+i.  The number of photos and size will be at the top of the Info drawer.
    OT

  • How to determine the size of an iMovie09 project?

    Hello:
    I recently created a nice video of about 2 hours in iMovie09. I "shared" it to iDVD but it was about 10% too big to burn. I went back to iMovie09 and removed some time to make the project smaller but how can I determine the size of my iMovie09 projects before I send them to iDVD? I know that both time and audio will affect the size of the iMovie09 project so the time of the video is not necessarily an accurate indicator.
    Thanks!

    Welcome to iMovie Discussions.
    As long as your movie is under about 1hr 50 minutes it should fit on a DVD.
    The thing which determines how much time is available on your DVD is usually the complexity of any Menus which you add in iDVD.
    With a simple Menu, which may "eat up" 10 mins of space, you should have room for 1h 50mins of movie.
    With complex, multi-level menus, your movie running time may be reduced by about 25 mins, or possibly more.
    Keep menus simple, and you should have space for about 1hr 50mins. It's always running time which counts, NOT "size" (in GB) of your movie.

  • How to measure the size of an object written by myself?

    Hi all,
    I'm going to measure the performance on throughput of an ad hoc wireless network that is set up for my project. I wrote a java class that represents a particular data. In order to calculate the throughput, I'm going to send this data objects from one node to another one in the network for a certain time. But I've got a problem with it- How to measure the size of an object that was written by myself in byte or bit in Java? Please help me with it. Thank you very much.

    LindaL22 wrote:
    wrote a java class that represents a particular data. In order to calculate the throughput, I'm going to send this data "a data" doesn't exist. So there's nothing to measure.
    objects from one node to another one in the network for a certain time. But I've got a problem with it- How to measure the size of an object that was written by myself in byte or bit in Java? Not.

  • Determining the Size of a Time Machine Backup File

    When I highlight a Time Machine backup file and then click on Get Info under File to determine the size of the backup file, the disk drive works its heart out, but the Get Info window never arrives at a determination of the file size being seemingly stuck in the "calculating size" state.
    Anybody have an idea of what's going on?
    JohnnyS

    JohnnyS wrote:
    Regarding your statement: "If you Enter Time Machine (the "Star Wars" interface), from a Finder window with a "size" column, then browse your backups, you should be able to see the sizes easily." - what do you mean by the "Star Wars" interface?
    Ah, you are new to Time Machine. Sorry, that's how you view and restore from your backups. Hold your mouse down on the TM icon in your Menubar and select +*Enter Time Machine,+* or click the TM icon in your Dock, or the +*Time Machine+* app in your Applications folder.
    If I look at the pull-down menu under Finder, I do not see Enter Time Machine. Am I looking in the wrong place? Obviously, since I couldn't get by the first step, I never got to a "size" column, and to be honest, I don't know that I have ever seen a Finder window with a "size" column.
    You can add one, by selecting View > as List, then View > Show View Options in a Finder window's menubar, and select or de-select whatever columns you want.
    I'm a little embarrassed by my lack of knowledge, but if I don't acknowledge my shortcomings, I'll never get the question answered. Thanks for taking your time to try to help me.
    Don't be. We all started at zero at one time or another.
    I'm not sure just what you were looking for in your first post. The size of all your TM backups is just the amount used on your external disk, unless you have other data in the same partition (which isn't a good idea). Because of the way TM works, you can't really determine the size of an individual backup, and it really wouldn't mean much.
    Perhaps if you clarified just what you want to know, we can help answer it.
    For more info on Time Machine, you might want to review these:
    Time Machine Tutorial
    Time Machine 101
    How to back up and restore your files
    Time Machine Features
    Apple - Support - Mac OSX v10.5 Leopard Time Machine
    and perhaps browse the Time Machine - Frequently Asked Questions *User Tip* at the top of this forum.
    If you have a problem setting-up or using Time Machine, start with the Time Machine - Troubleshooting *User Tip* at the top of this forum. It will show you how to locate the message(s) that describe the problem, then help you fix it.

  • How to stop changing stroke weights when changing the size of an object in CS5 on Windows 7?

    I'm not sure what I did to make this happen or how to change it back, but for some reason when I change the size of an object/line it changes the stroke weight as well. (For example, if I drew an ellipse with stroke weight 2 pt, and then increased the size the stroke weight would be 2.856 pt or some such number instead of 2 pt.) Does anyone know how to change this back?
    Thanks!

    Take a look at the Scale Strokes and effects preference either in the general programme preferences or in the flyout menu of the Transform palette.

  • How do I determine the size of my iTunes library

    How do I determine the size of my iTunes library?

    In Music view, you will see the song count, size, and total playing time in the Status Bar at the bottom. 
    If the Status Bar is not present, enable it either via View > Show Status Bar, or by holding the CTRL key while you press the / key.

  • Determine the size of EDI payload data

    Hi Experts,
    As far as my B2B Knowledge is concerned, in order to know the size of an EDI payload... we download the payload from wire message or payload, copy the data and paste it in a file. The size of the file determines the EDI payload size.
    But, this is a tedious task, particularly in cases where there are huge number of EDI data. To far as I know, the size of EDI files ranges from 1 MB to 1GB.
    Please advise what should I do in cases of files with large payload sizes(more than 25MB).
    Please advise if there is any B2B table whose one of the columns depicts the size of the payload.
    I have searched through some b2b table as b2b_messageinstance, b2b.ip_b2b_report but could not find any such columns.
    Please advise what exactly the procedure is to determine the size of EDI payload data, particularly for cases where payload data is larger than 25 MB.

    I am afraid that there is no direct way of finding the payload size in 10g. You may write your own standalone program or API which may calculate the size of payload by querying the b2b_instancemessage view or by calling the B2B InstanceMessage API -
    http://www.oracle.com/technetwork/testcontent/b19324-01-instance-msg-api-129535.zip
    Regards,
    Anuj

  • Apache Installation configure: error: could not determine the size of off_t

    Hi,
    I was installing Apache httpd-2.2.g.tar.gz, i got the below error message while configure.
    checking size of short... 2
    checking for long long... yes
    checking size of long long... 8
    checking for INT64_C... yes
    checking size of ssize_t... 0
    checking size of size_t... 0
    checking size of off_t... 0
    checking which type to use for apr_off_t... configure: error: could not determine the size of off_t
    configure failed for srclib/apr
    gnumake: *** [/net/usr.scratch/i030947/deepak/platforms/sun/cs2/httpd-2.2.8/inst/include/ap_config_auto.h] Error 1
    Regards
    Deepak

    "aparequest.h", line 4: Error: Could not open include file "ap_config_auto.h".
    "httpd-2.2.8/include/ap_config.h", line 25: Error: Could not open include file "apr.h".
    "httpd-2.2.8/srclib/apr-util/include/apr_hooks.h", line 20: Error: Could not open include file "apu.h".
    "httpd-2.2.8/srclib/apr/include/apr_tables.h", line 25: Error: Could not open include file "apr.h".
    "httpd-2.2.8/srclib/apr/include/apr_pools.h", line 37: Error: Could not open include file "apr.h".
    "httpd-2.2.8/srclib/apr/include/apr_errno.h", line 25: Error: Could not open include file "apr.h".
    "httpd-2.2.8/srclib/apr/include/apr_errno.h", line 52: Error: "{" expected instead of "apr_strerror".
    "httpd-2.2.8/srclib/apr/include/apr_errno.h", line 52: Error: Unexpected type name "apr_status_t" encountered.
    "httpd-2.2.8/srclib/apr/include/apr_errno.h", line 52: Error: statcode is not defined.
    "httpd-2.2.8/srclib/apr/include/apr_errno.h", line 52: Error: Badly formed expression.
    "httpd-2.2.8/srclib/apr/include/apr_general.h", line 28: Error: Could not open include file "apr.h".
    "httpd-2.2.8/srclib/apr/include/apr_general.h", line 160: Error: Only one of a set of overloaded functions can be extern "C".
    "httpd-2.2.8/srclib/apr/include/apr_general.h", line 160: Error: std::memchr(const void, int, unsigned long), returning void, was previously declared returning const void*.
    "httpd-2.2.8/srclib/apr/include/apr_general.h", line 176: Error: Only one of a set of overloaded functions can be extern "C".
    "httpd-2.2.8/srclib/apr/include/apr_general.h", line 176: Error: "{" expected instead of "apr_initialize".
    "httpd-2.2.8/srclib/apr/include/apr_general.h", line 176: Error: Badly formed expression.
    "httpd-2.2.8/srclib/apr/include/apr_general.h", line 190: Error: Unexpected type name "apr_status_t" encountered.
    "httpd-2.2.8/srclib/apr/include/apr_general.h", line 190: Error: Badly formed expression.
    "httpd-2.2.8/srclib/apr/include/apr_general.h", line 192: Error: A declaration was expected instead of "char".
    "httpd-2.2.8/srclib/apr/include/apr_general.h", line 192: Error: Use ";" to terminate declarations.
    "httpd-2.2.8/srclib/apr/include/apr_general.h", line 192: Error: "," expected instead of ")".
    "httpd-2.2.8/srclib/apr/include/apr_general.h", line 203: Error: Badly formed expression.
    "httpd-2.2.8/srclib/apr/include/apr_general.h", line 214: Error: Badly formed expression.
    "httpd-2.2.8/srclib/apr/include/apr_want.h", line 17: Error: Could not open include file "apr.h".
    "httpd-2.2.8/srclib/apr/include/apr_pools.h", line 158: Error: Only one of a set of overloaded functions can be extern "C".
    Compilation aborted, too many Error messages.
    gnumake: *** [apacsrvstate.22o] Error 1
    Is it because the apache source file is missing ?
    Regards
    Deepak

Maybe you are looking for