Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
InputStream stream = new ByteArrayInputStream(contentString.getBytes("UTF-8"));
CustomContentProperties properties = new CustomContentProperties();
properties.setProperty("customProperty", new StringValue("value"));
String contentName = "content name";
String contentType = "text/plain";
if(contentManager instanceof IChannelContentManager channelContentManager) {
  // Using the Java NIO-based API introduced in Blueriq 17.4
  GUID contentId = channelContentManager.create(Channels.newChannel(stream), contentName, contentType, null, null, properties, context.getSessionScope().getActiveUser());
} else {
  // Using the stream-based API that was deprecated in Blueriq 17.4 and might be released in a future release
  GUID contentId = contentManager.create(stream, contentName, contentType, null, null, properties, context.getSessionScope().getActiveUser()); 
}

...