cancel
Showing results for 
Search instead for 
Did you mean: 

Which service for writing content?

davidpisaac
Champ in-the-making
Champ in-the-making
I'm a little confused about what service I should use to create a file…the FileFolderService or the ContentService, or perhaps even the NodeService.  The javadoc says the getWriter and getReader are different for the first two, but does not say how.  Any hints are appreciated.
1 REPLY 1

hbf
Champ on-the-rise
Champ on-the-rise
I understand it as follows (but that comes without any guarantee): You can create the file using the NodeService's createNode() method; then you'd get a writer for it using ContentService's getWriter() method and save your file (you have to set the mime-type and encoding, too, by calling setMimetype() and setEncoding() on the writer).

The FileFolderService is built on top of NodeService and ContentService and provides some utility routines for the special case of dealing with files and folders (these are two particular kinds of nodes). This means you can, instead of using the NodeService and ContentService, also use the FileFolderService.

Hope this help,
Kaspar