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.
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