code: public void importLdif(InputStream ldifData) throws IOException {
  
          final File ldifFile = getOuterRule().newFile("scribble_import.ldif");
          try (final Writer writer = new OutputStreamWriter(new FileOutputStream(ldifFile), Charsets.UTF_8)) {
  
              IOUtils.copy(ldifData, writer);
          }
          final String pathToLdifFile = ldifFile.getAbsolutePath();
          final CoreSession session = this.getDirectoryService().getAdminSession();
          final LdifFileLoader loader = new LdifFileLoader(session, pathToLdifFile);
          loader.execute();
  
      }
docs: Imports directory content that is defined in LDIF format and provided as input stream. The method writes the
  stream content into a temporary file.
  
  @param ldifData
  the ldif data to import as a stream
  
  @throws IOException
  if the temporary file can not be created