Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Fetch the first n bytes of a file inside a Change Set in a RTC precondition

 Hi

I plan to develop a RTC precondition that checks, whether a file that is delivered is a binary file or not. Therefore I would like to read the first n bytes of the files and then look, if it uses mainly usual characters or not.

I already can fetch the content of the files, by getting all IFileItem of the change set and then fetch the content with the IServerSideVersionedContentService:
IServerSideVersionedContentService contentService =
  (IServerSideVersionedContentService) getService(IServerSideVersionedContentService.class);
ByteArrayOutputStream out = new ByteArrayOutputStream();
contentService.fetchContentTrusted(file,content.getHash(), out);

But with the method fetchContentTrusted I get always the whole file. What I would need, due to performance issues, is only to fetch the first n bytes. Is there a way to get only the first n bytes instead of the whole content?

Thanks and regards

Martin

0 votes


Be the first one to answer this question!

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,930

Question asked: Sep 22 '15, 5:06 a.m.

Question was seen: 2,357 times

Last updated: Sep 22 '15, 5:12 a.m.

Confirmation Cancel Confirm