It's all about the answers!

Ask a question

Creating file items in SCM : IFileItem.CONTENT_TYPE_UNKNOWN vs IFileItem.CONTENT_TYPE_TEXT


Jazzuser user (68849) | asked Aug 08 '17, 4:41 a.m.

Hello All,

We are using following code to create file item :

    aFile = (IFileItem) IFileItem.ITEM_TYPE.createItem();
    aFile.setParent(parentFolder);
    aFile.setName(name);
    aFile.setContentType(IFileItem.CONTENT_TYPE_UNKNOWN);

but setContentType can have the values :
CONTENT_TYPE_TEXT
CONTENT_TYPE_XML
CONTENT_TYPE_UNKNOWN,

Also, for copying the contents we have :
 IFileContentManager contentManager = FileSystemCore.getContentManager(fTeamRepository);
             IFileContent storedzipContent = contentManager.storeContent(
                 IFileContent.ENCODING_UTF_8,
                 FileLineDelimiter.LINE_DELIMITER_NONE,
                 new VersionedContentManagerByteArrayInputStreamPovider(
                         contents.toByteArray()), null, fMonitor);,
                 new VersionedContentManagerByteArrayInputStreamPovider(
                         contents.toByteArray()), null, fMonitor);

But few questions remains unanswered for us.. please help :

1. When should we use CONTENT_TYPE_UNKNOWN ? how is it different from CONTENT_TYPE_TEXT ?

2. If we use CONTENT_TYPE_TEXT, it is supporting all the formats we need, including xml, then why do we have CONTENT_TYPE_XML also ? is it something that CONTENT_TYPE_TEXT cant support XML ?

3. Is there any dependency between CONTENT_TYPE_UNKNOWN, ENCODING_UTF_8 and
LINE_DELIMITER_NONE.

Please suggest where can we get more info on this.

Thanks.

One answer



permanent link
Ralph Schoon (63.1k33646) | answered Aug 09 '17, 2:07 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Aug 09 '17, 4:01 a.m.

I can only use common sense to answer this.

CONTENT_TYPE_TEXT is text and will be treated as such. Files with this content will likely show up as text representation in the web UI. You can likely merge them and the line delimiter and encoding actually have a purpose.

I don't know about CONTENT_TYPE_UNKNOWN and the rules that apply. I have, in the past, when I was unsure tried to look at what the tooling does. You can see all these values as properties of the elements in the Eclipse views. So you can check in content such as text files and xml files and other stuff and look at what you get. There is also a mapping defined for what is text or binary in the Eclipse client.

So, if you are unsure, play with content and have a look what the RTC client does.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.