Urgent: How to find out the size in bytes of java object

Hi Experts,
We've a requirement that we need to find out the size of a java object at run time, is there a direct java API to get the size of a composite object in memory?
Here is my requirement: We are adding string objects (which is an xml string of considerable size) into a List. After reaching certain size limit (lets say 5MB) of the list i need to put this data into DB as a CLOB. So every time I add a string object to the list, I need to see if the total size of the list exceeds the limit and if yes, flush the results into DB.
I am not sure if java has a direct API for this, if not what is the beast way to do it, it s critical requirement for us.
It would be really great if someone could help us out.
Thank you,
-Shibu.

>
We've a requirement that we need to find out the size of a java object at run time, is there a direct java API to get the size of a composite object in memory?
Here is my requirement: We are adding string objects (which is an xml string of considerable size) into a List. After reaching certain size limit (lets say 5MB) of the list i need to put this data into DB as a CLOB. So every time I add a string object to the list, I need to see if the total size of the list exceeds the limit and if yes, flush the results into DB.
I am not sure if java has a direct API for this, if not what is the beast way to do it, it s critical requirement for us.
It would be really great if someone could help us out.
>
Could you explain your actual requirement a little more fully.
1. Is each individual string a separate XML string? Or is it just a fragment? Why would you just concatenate them together into a CLOB? That won't produce valid XML and it won't let you easily separate the pieces again later. So provide a simple example showing some strings and how you need to manipulate them.
2. Are you using these xml strings in Java at all? Or are you just loading them into the database?
For example if you are just loading them into the database you don't need to create a list. Just create a CLOB in Java and append each string to the CLOB. Before you append each one you can check to see if the new string will put you over your length limit. If it will then you write the CLOB to the database, empty the CLOB and start appending again to the new clob instance.
If you explain what you are really trying to do we might be able to suggest some better ways to do it.

Similar Messages

  • How to find out the size of files transferred over the SQL * Net?

    I am trying to test the Advanced Compress (AC) for 11g Data Guard. When the AC is turned on, the archived log files are supposed to be compressed on the primary database server and sent over SQL*Net, then decompressed on the standby db server. We will see the file sizes are the same on both primary and standby servers. I want to verify that the AC works by monitoring how much data are sent over SQL*Net. Per Oracle, AC uses 35% less of the bandwith. That means the size of the files transferred should be at least 65% of the original size.
    Is there a way to find out the size through Oracle utilities? If not, how to find out by OS utilities? OS is Solaris 5.10.
    Thanks.

    I'm not sure this can be done via SQL*Net, but a network packet sniffer between the two servers should be able to help - you might want to contact your network team.
    HTH
    Srini

  • How to find out the size of a database?

    I'm not an oracle dba but a report developer. I'd like to find out the size of my database.
    Is this possible using simple query?

    An oracle database consists of data files, redo log files, control files, temporary files. Whenever you say the size of the database this actually means the summation of these files.
    select a.data_size+b.temp_size+c.redo_size+d.controlfile_size "total_size in MB"
    from
    ( select sum(bytes)/1024/1024 data_size from dba_data_files ) a,
    ( select nvl(sum(bytes),0)/1024/1024 temp_size from dba_temp_files ) b,
    ( select sum(bytes)/1024/1024 redo_size from sys.v_$log ) c,
    ( select sum(BLOCK_SIZE*FILE_SIZE_BLKS)/1024/1024 controlfile_size from v$controlfile) d;
    here
    a is megabytes allocated to ALL datafiles
    b is megabytes allocated to ALL TEMP files
    c is megabytes allocated to ALL redo-logs
    d is megabytes allocated to ALL control files
    Nimish Garg
    Software Developer
    *(Oracle & ASP.NET)*
    Indiamart Intermesh Limited, Noida
    To Get Free Oracle & ASP.NET Code Snippets
    Follow: http://nimishgarg.blogspot.com

  • URGENT: How to find out the Tables for Routines  in BW.

    Hi BW Gurus,
    How to find out the Tables for Routines  in BW.
    I have this routine id <b>45XFAEI7LKIFIRDUKQG127YWW</b> and it is in inactive state and i want to activate it.
    thanks in advance,
    points will be rewarded.
    Regards,
    Maruthi.

    Hi Maruthi,
    Check table RSUPDROUT using the routine id as input for the field CODEID. You will get the technical name of the update rule.
    Cheers,
    Praveen.

  • How to find out the properties of a field's/object's?

    Hello
    I have field (say, its name is field_1) in my_form and  i am coloring yellow by using below code of initialization event:
    this.ui.oneOfChild.border.fill.color.value = "255,255,191"; (Actually, just for differentiating / tracing back purpose here  am assigning this yellow color to this field, you can suggest me any thing else that marks / tags this field (i can not populate a value, bcz its visible to user), so that in the  CHANGE event of this field, again i want to check/get/know that whether this field is tagged/marked or not)
    fine. But, because of some/below reason, i need to find out its color by using JavaScript, pls. let me know how to figure out its color is as yellow by using JavaScrit?
    Reason: If field_1's color is YELLOW (or you suggested any tag/mark as said in the above in red text), then i have to make HIDE the field_2
    Field_0's position is extreme left, Field_1's  position is middle and the Field_2's position is exterme right of the page.
    I guess, i hv only one option of finding out color, hence am looking forward for JavaScript to find out the color of a field in question
    (OR)
    Also, pls. let me know the JavaScript that How can i make HIDE a check box for that COMLETE session (i mean, starting from launching the form in the browser until he closes the window/browser/tab/form), i guess, this idea also workes for my requirement, ( i want to put this code in the docReady event) .....no matter/what ever code is existing there in any event of that field level
    Thank you

    The unix file command:
    file *
    foo.doc ms-office file / word
    bar.png png image, 32x32 pixels, no transparency
    moo.hhml html text
    note that as in the last - file names are ignored, it works by checking the beginning of each file's data against it's database, and as in #2 it can sometimes see a lot more than just the file format.
    Don't know of a windows port, you could try cygwin

  • How to find out the parameter type of a parameterized object?

    Hi,
    I've got a list containing instances of a parameterized class. The parameters of the instances can be different. When using the instances, I need to know the types of the parameters. How can I find them out?
    Regards,
    Frank

    Look at the first item in the List and see what it is?
    I'm not trying to be funny. Generic information is compile time only, the types of the parameters are not generally available at run time.
    You can find out the bounds on the types, if any, but not the actual types.
    AndyT

  • How to find out the size of a file?

    Hi,
    I would like to determine the size of a file from my code. How is that possible? I do not find any appropriate method in the java.io.File class.
    Any help would be very appreciated!

    java.io.File.length()
    Returns the size of the file as a long. The number corresponds to the number of bytes in the file.

  • How to find out the size of the info cube.

    Hai,
          Could any one guide me to find the size of an infocube.
    Bye.

    Hi,
    check trasaction DB02 where u can find the cube size..
    check this..
    Re: Infocube size?
    Regards-
    MM
    Dont forget to assign points
    Message was edited by: vishnuC

  • How to find out the Size of a TV Season before purchasing from itunes

    I am wanting to purchase the Downton Abbey Season on itunes, but my ipad says there is not enough space, is there away I can view the size of the download before I purchase it?
    Thank you

    There's no official way of doing it, unlike with Movies where the download size is under the title. However a rough guide seems to be allow around up to 34MB per min for HD and maybe up to 15MB per min for SD. So, using Downton Abbey Season 1, this would mean the total download would be about 12.9GB in HD and about 5.3GB in SD. Season 2 will be a bigger download still since each episode is longer plus there's an extra episode. Season 2 would probably be around 15.4GB in HD and 6.3GB in SD.
    Hope this helps a little.

  • How to find out the size of a node before it is shown?

    Hi,
    I am trying to anchor two nodes (say A & B) to the top of an anchor pane such that B is laid out below A. To accomplish this, I need to provide an anchor offset for the control B, which has to be height of the node A. However, as the containing Stage has not been shown yet, the A's node getWidth() method returns 0 (zero). Since, node A's size is computed based on its contents, I can't hardcode its size. So, I am at a loss how to provide the height of the node A in a dynamic manner.
    Please feel free to ask me to clarify the question if I didn't make myself clear enough.
    Thanks.

    If one of the existing layouts doesn't work for you, then you can create your own. A little bit harder to do, but this would be your best bet since there is no trickery involved. Basically, all you have to do is override the layoutChildren() and the computePrefXXX (and, perhaps computeMinXXX) methods from Parent.
    Here is any overly simplified example that lays out three circles like a traffic light:
        @Override
        public void start(final Stage stage) {
            Parent parent = new Parent() {
                    getChildren().addAll(
                        CircleBuilder.create().fill(Color.RED).radius(20).build(),
                        CircleBuilder.create().fill(Color.YELLOW).radius(20).build(),
                        CircleBuilder.create().fill(Color.GREEN).radius(20).build()
                @Override protected void layoutChildren() {
                    double dx = 0;
                    double dy = 0;
                    for(int n=0, nMax=getChildren().size(); n<nMax; n++) {
                        Node child = getChildren().get(n);                   
                        double prefHeight = child.prefHeight(-1);
                        dy = prefHeight * n + prefHeight / 2;
                        child.setLayoutY(dy);
                        dx = child.prefWidth(-1) / 2;
                        child.setLayoutX(dx);
                @Override
                protected double computePrefHeight(double width) {
                    double prefHeight = 0;
                    for(Node child : getChildren()) {
                        prefHeight += child.prefHeight(width);
                    return prefHeight;
                @Override
                protected double computePrefWidth(double height) {
                    return getChildren().get(0).prefWidth(height);
            Scene scene = new Scene(parent);
            stage.setScene(scene);
            stage.show();
        }

  • How to find out the transaction size

    Hai
    Is it possible ,how to find out the size of transaction ?
    Any one idea about this should be appreciated
    Regards
    mohan

    Hai
    Is it possible ,how to find out the size of transaction ?
    Any one idea about this should be appreciated
    Regards
    mohan create a small rollback segment to start with, with small initial and next extent sizes and maxextents unlimited.
    assign this rollback segment to the test session and run the particular transaction.
    query the view v$rollstat to see how much the rollback segment has extended.
    this is roughly your transaction size. this may not accurate but its give you
    a general idea of how much data is generated.

  • How to find out the application server info

    Hi, I am wondering how to find out the application server info in Java code, just like how to find out the db platform being used. Thanks

    Hi,
    I am not aware of any spec defined way of finding out such info. There may be vendor specific APIs or mechanisms.
    But you can use environment entries in your deployment descriptors to specify the information and make use of the entries inside your j2ee component. That will make your code platform neutral.
    Sahoo

  • How do i find out the size of a webpage?

    how do i find out the file size of a webpage im viewing in my
    browser? and how do i find out the size of a webpage of my
    own?

    Hello,
    Try this site out.
    Just enter your URL.
    http://www.websiteoptimization.com/services/analyze/
    Take care,
    Tim
    "name294" <[email protected]> wrote in
    message
    news:gpiuqv$9on$[email protected]..
    > how do i find out the file size of a webpage im viewing
    in my browser? and
    > how do i find out the size of a webpage of my own?

  • How do I find out the size of each individual element within a photoshop file as need to replace some elements?  Thanks :)

    How do I find out the size of each individual element within a photoshop file as need to replace some elements?  Thanks

    What do you mean by "Elements"?
    Elements in a flat image or Layers?
    Could you please post a screenshot with the Layers Panel visible?

  • How to find out the image size?

    How to find out the image size values(Width and height) in illustrator CS3 using any script. I tried but i got only the document height and width. I need to find out the image BoundingBox value of width and height. Kindly advice me.

    Try this.
    tell application "Adobe Illustrator"
    set heightImage to get height of raster item 1 of current layer of current document
    set widthImage to get width of raster item 1 of current layer of current document
    display dialog (heightImage & " X " & widthImage) as string
    end tell
    JaiMS

Maybe you are looking for

  • Issue with SSRS 2008

    Hey, I am trying to generate this oracle database report and getting this error message. I am using SSRS 2008 to build this report and the query is not responding. It give me: ORA-01858: a non-numeric character was found where a numeric was expected

  • Render Error?

    I just recentlt got Final Cut Pro, and I have create a video and everything ahs been working well so far,e xcept when I came to work on it this afternoon it came up with this +Render Error+ message. I've checked that all the check marks are checked u

  • What is the 'add marker' feature used for in iMovie 10?

    Can anyone tell me what the 'add marker' feature is used for in iMovie 10, I cant find any documentation on it anywhere, it doesnt even show under the help menu???

  • Hide RichTextBox controls + title, etc.

    hi all, i'm using the mx:RichTextEditor and i've hidden the controlBar, but is it possible to just get the actual text area, without the title area and the margins outside of the box, etc?

  • Using Store Procedures with BC4J - Help

    I need some help, could you explain me how to call some store procedures on an Entity Object with a source code. I really apreciate your help. null