/** * Writes a bookmark folder. * * @since 3.8.2 */ private void writeBookmarkFolder(BookmarkFolder folder, String filename, Permission permission) { try { if (ACCESS.check(permission)) { byte[] bytes = SerializationUtility.createObjectSerializer().serialize(folder); // RemoteFile spec = new RemoteFile("bookmarks", filename, 0); spec.readData(new ByteArrayInputStream(bytes)); BEANS.get(IRemoteFileService.class).putRemoteFile(spec); } } catch (IOException e) { throw new ProcessingException("", e); } }
/** * Reads a bookmark folder. * * @since 3.8.2 */ private BookmarkFolder readBookmarkFolder(String filename) { RemoteFile spec = new RemoteFile("bookmarks", filename, 0); RemoteFile f = BEANS.get(IRemoteFileService.class).getRemoteFile(spec); if (f.exists()) { try { byte[] bytes = f.extractData(); return SerializationUtility.createObjectSerializer() .deserialize(bytes, BookmarkFolder.class); } catch (Exception t) { LOG.error("Could not deserialize bookmark folder", t); } } return null; }