You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@chemistry.apache.org by Sebastian Danninger <se...@googlemail.com> on 2013/01/28 14:14:49 UTC
Deleting content of a file
Dear all,
is there an easy way of deleting the content of a file, without removing
the file itself (clearing it)?
I saw that i can call setContentStream with a new contentstream and that
there is a deleteContentStream but then the file is "broken"
The node's content is missing:
node: workspace://SpacesStore/28c5a8f1-9589-455c-9afe-262438c61c61
reader: null
any suggestions?
Re: Deleting content of a file
Posted by Sebastian Danninger <se...@googlemail.com>.
Okay, I was just wondering, so for Alfresco I came up with this solution
(in case someone else might need it)
String str ="";
InputStream bais = new ByteArrayInputStream(str.getBytes());
ContentStream cs = new ContentStreamImpl(filename,
BigInteger.valueOf(Long.parseLong("0")), "UTF-8", bais);
doc.deleteContentStream(true);
doc.setContentStream(cs, true);
2013/1/28 Florian Müller <fm...@apache.org>
> Hi Sebastian,
>
> From a CMIS point of view deleteContentStream() is what you are looking
> for.
> Not all repositories support it, though. Some repositories need a content
> stream with 0 bytes. You should ask the repository vendor.
>
>
> Florian
>
>
>
> Dear all,
>>
>> is there an easy way of deleting the content of a file, without removing
>> the file itself (clearing it)?
>>
>> I saw that i can call setContentStream with a new contentstream and that
>> there is a deleteContentStream but then the file is "broken"
>>
>> The node's content is missing:
>> node: workspace://SpacesStore/**28c5a8f1-9589-455c-9afe-**262438c61c61
>> reader: null
>>
>> any suggestions?
>>
>
>
Re: Deleting content of a file
Posted by Florian Müller <fm...@apache.org>.
Hi Sebastian,
From a CMIS point of view deleteContentStream() is what you are looking
for.
Not all repositories support it, though. Some repositories need a
content stream with 0 bytes. You should ask the repository vendor.
Florian
> Dear all,
>
> is there an easy way of deleting the content of a file, without
> removing
> the file itself (clearing it)?
>
> I saw that i can call setContentStream with a new contentstream and
> that
> there is a deleteContentStream but then the file is "broken"
>
> The node's content is missing:
> node: workspace://SpacesStore/28c5a8f1-9589-455c-9afe-262438c61c61
> reader: null
>
> any suggestions?