protected GridFSInputFile create(Type type, boolean createEmptyFile) {
   Assert.notNull(type, "Type must not be null");
   GridFSInputFile file = this.fs.createFile(getFilename(getPath()));
   JailedResourcePath parent = this.path.getParent();
   if (parent != null) {
     file.put(PARENT, parent.getUnjailedPath().toString());
   }
   file.put(RESOURCE_TYPE, type.name());
   if (createEmptyFile) {
     try {
       file.getOutputStream().close();
     } catch (IOException e) {
       throw new ResourceException(e);
     }
   }
   return file;
 }
 public OutputStream getOutputStream() {
   return input.getOutputStream();
 }
 @Override
 public OutputStream getOutputStream() {
   delete();
   GridFSInputFile file = create(Type.FILE, false);
   return file.getOutputStream();
 }