Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 453913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T22:13:07+00:00 2026-05-12T22:13:07+00:00

I want to copy the content from one object stored in one docbase to

  • 0

I want to copy the content from one object stored in one docbase to another object stored in another docbase. I do not want to create a file because I have more than 300 k files to copy. Below is a part of my code:

ByteArrayOutputStream baos = new ByteArrayOutputStream();

IOUtils.copy(source.getContent(), baos);

[...]
targetObj.setContent(baos); // Documentum DFC
targetObj.save(); // Documentum DFC

If I do not tune the JVM, IOUtils.copy(source.getContent(), baos); gives java.lang.OutOfMemoryError: Java heap space.

If I tune the JVM by setting Xmx max value, the previous instruction is ok, but java.lang.OutOfMemoryError: Java heap space occurs with targetObj.setContent(baos);.

With an only 8332175 Bytes large content… (7.94 MB)

Any idea what’s wrong? A better way to copy from ByteArrayInputStream to ByteArrayOutputStream? Something else?


Some Documentum API

getContent

public ByteArrayInputStream getContent()
throws DfException

Copies this object’s content from the Documentum server into a ByteArrayInputStream >object.

The following code example demonstrates how to copy an objects content from the >Documentum server into memory:

    IDfSysObject sysObj = (IDfSysObject)session.getObject(new DfId("0900d5bb8001f900"));
    ByteArrayInputStream bais = sysObj.getContent();
    if (bais.available() > 0)
    {
         // Data successfully fetched from the server...
    }

Returns:
a ByteArrayInputStream object containing the objects content.
Throws:
DfException – if a server error occurs.

And

setContent

public boolean setContent(ByteArrayOutputStream content)
throws DfException

Sets new content to an object. Use this method when you want to set data that resides >in working memory.

The following code example demonstrates how to set content residing in memory to a new document:

    IDfSysObject sysObj = (IDfSysObject)sess.newObject("dm_document");
    sysObj.setObjectName("testDoc");
    sysObj.setContentType("crtext");
    byte b[] = {35,36,37,38,39};
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    out.write(b, 0, 5);
    sysObj.setContent(out);
    sysObj.save();

Parameters:
content – the content as a ByteArrayOutputStream.
Throws:
DfException – if a server error occurs.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T22:13:07+00:00Added an answer on May 12, 2026 at 10:13 pm

    As long as you use ByteArrayOutputStream, the data will have to fit in memory.

    I know nothing about Documentum, but is there maybe a targetObj.setContent(File) or setContent(InputStream), so that you can avoid reading the whole chunk into a byte[]?

    (8MB is not all that huge though, maybe you can just adjust the Java heap space. It could also help to pre-size the buffer used by the BAOS, you can pass the initial size to its constructor)

    Update: Are you sure setContent takes a ByteArray Output Stream? Usually, a setter would read from an InputStream.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a small java application to copy some wiki content from
I have two Java.io.File objects file1 and file2. I want to copy the contents
I want to copy files that have timestamps from the time the script begins
I'm in the middle of trying to copy a custom content type from one
I need to copy data from one database to another with EF. E.g. I
I am copying content from one table to another as follows; var ntr='',//to store
Help. TCHAR* b; TCHAR* c=TEXT(qwerty); I want to allocate memory and copy content of
I want to write nuspec for MEF plugin. I can copy xxx.dll to content
I want to copy contents of one row in Excel to other row. Currently,
I have an NSMutabaleArray with few contents, and want to copy the contents to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.