Creates a new {@link HttpFileService} for the specified {@code rootDir} in the current class path.
773898
public static HttpFileService forClassPath(ClassLoader classLoader, String rootDir) {
        return HttpFileServiceBuilder.forClassPath(classLoader, rootDir).build();
    }
828888
private void createLibFolder() throws IOException {
        if(!Files.exists(libLocation.toPath()))
            Files.createDirectories(libLocation.toPath());
    }
1101259
@Override
    public ICodeBaseLocator createRelativeCodeBaseLocator(String relativePath) {
        File path = new File(pathName);
        if (!path.isDirectory()) {
            path = path.getParentFile();
        }
        File relativeFile = new File(path, relativePath);
        return new FilesystemCodeBaseLocator(relativeFile.getPath());
    }
392665
static public void recursiveCreateDirectory(FTPClient ftpClient, String path) throws IOException {

		logger.info("Create Directory: {}", path);
		int createDirectoryStatus = ftpClient.mkd(path); // makeDirectory...
		logger.debug("Create Directory Status: {}", createDirectoryStatus);
		
		if (createDirectoryStatus == FTP_FILE_NOT_FOUND) {
			int sepIdx = path.lastIndexOf('/');
			if (sepIdx > -1) {
				String parentPath = path.substring(0, sepIdx);
				recursiveCreateDirectory(ftpClient, parentPath);

				logger.debug("2'nd CreateD irectory: {}", path);
				createDirectoryStatus = ftpClient.mkd(path); // makeDirectory...
				logger.debug("2'nd Create Directory Status: {}", createDirectoryStatus);
			}
		}
	}
776282
public static HttpFileBuilder ofResource(ClassLoader classLoader, String path) {
        requireNonNull(classLoader, "classLoader");
        requireNonNull(path, "path");

        // Strip the leading slash.
        if (path.startsWith("/")) {
            path = path.substring(1);
        }

        // Retrieve the resource URL.
        final URL url = classLoader.getResource(path);
        if (url == null || url.getPath().endsWith("/")) {
            // Non-existent resource.
            return new NonExistentHttpFileBuilder();
        }

        // Convert to a real file if possible.
        if ("file".equals(url.getProtocol())) {
            File f;
            try {
                f = new File(url.toURI());
            } catch (URISyntaxException ignored) {
                f = new File(url.getPath());
            }

            return of(f);
        }

        return new ClassPathHttpFileBuilder(url);
    }
211046
public static boolean createFolder(String folderPath) {
        if (!StringUtils.isEmpty(folderPath)) {
            File folder = new File(folderPath);
            return createFolder(folder);
        }
        return false;
    }
1056470
WritableByteChannel createInternal(URI path, CreateFileOptions options)
      throws IOException {

    // Validate the given path. false == do not allow empty object name.
    StorageResourceId resourceId = pathCodec.validatePathAndGetId(path, false);
    if (options.getExistingGenerationId() != StorageResourceId.UNKNOWN_GENERATION_ID) {
      resourceId = new StorageResourceId(
          resourceId.getBucketName(),
          resourceId.getObjectName(),
          options.getExistingGenerationId());
    }
    WritableByteChannel channel = gcs.create(resourceId, objectOptionsFromFileOptions(options));
    tryUpdateTimestampsForParentDirectories(ImmutableList.of(path), ImmutableList.<URI>of());
    return channel;
  }
472199
@Override
    protected Smb2QueryDirectoryResponse createResponse ( CIFSContext tc, ServerMessageBlock2Request<Smb2QueryDirectoryResponse> req ) {
        return new Smb2QueryDirectoryResponse(tc.getConfig(), this.fileInformationClass);
    }
792348
protected final JimfsPath createPathInternal(@Nullable Name root, Iterable<Name> names) {
    return new JimfsPath(this, root, names);
  }
1273019
public static LocalFileResource newResource(String normalizedPath, String repositoryPath, SymbolicRootResource root) {
        return new LocalFileResource(normalizedPath, repositoryPath, root);
    }
485819
public static void createFile(String filePath) throws IOException {
    Path storagePath = Paths.get(filePath);
    Files.createDirectories(storagePath.getParent());
    Files.createFile(storagePath);
  }
919485
public static HttpHandler createRootHandler(
            List<MappedEndpoint> mappedEndpoints,
            List<Interceptor> rootInterceptors,
            List<Interceptor> endpointInterceptors,
            ExceptionMapper exceptionMapper,
            String basePath,
            boolean httpTracer) {

        final RoutingHandler routingRestHandler = new HttpRootHandler(false);
        final PathTemplateHandler websocketHandler = Handlers.pathTemplate(false);
        HttpHandler staticHandler = null;


        for (MappedEndpoint me : mappedEndpoints) {

            if (MappedEndpoint.Type.REST.equals(me.type)) {
                HttpHandler httpDispatcher =
                        new BlockingHandler(
                                new HttpDispatcher(
                                        new ConnegHandler(
                                                new InterceptorHandler(me.handler, endpointInterceptors), me.mediaTypes
                                        ),
                                        exceptionMapper
                                )
                        );

                String endpointPath = HandlerUtil.BASE_PATH.equals(basePath) ? me.url : basePath + me.url;

                HttpHandler httpHandler = wrapCompressionHandler(httpDispatcher, me);
                routingRestHandler.add(me.method, endpointPath, httpHandler);
            }
            if (MappedEndpoint.Type.MULTIPART.equals(me.type)) {
                HttpHandler httpDispatcher =
                        new BlockingHandler(
                                new HttpDispatcher(
                                        new ConnegHandler(
                                                new InterceptorHandler(me.handler, endpointInterceptors), me.mediaTypes),
                                        exceptionMapper)
                        );

                String endpointPath = HandlerUtil.BASE_PATH.equals(basePath) ? me.url : basePath + me.url;

                HttpHandler httpHandler = wrapCompressionHandler(httpDispatcher, me);
                routingRestHandler.add(me.method, endpointPath, httpHandler);
            }
            if (MappedEndpoint.Type.SSE.equals(me.type)) {
                InterceptorHandler interceptorHandler = new InterceptorHandler(me.handler, endpointInterceptors);
                HttpHandler httpHandler = wrapCompressionHandler(interceptorHandler, me);

                String endpointPath = HandlerUtil.BASE_PATH.equals(basePath) ? me.url : basePath + me.url;
                routingRestHandler.add(me.method, endpointPath, httpHandler);
            }
            if (MappedEndpoint.Type.WS.equals(me.type)) {
                InterceptorHandler interceptorHandler = new InterceptorHandler(me.handler, endpointInterceptors);
                HttpHandler httpHandler = wrapCompressionHandler(interceptorHandler, me);
                websocketHandler.add(me.url, httpHandler);
            }
            if (MappedEndpoint.Type.STATIC.equals(me.type)) {
                staticHandler = wrapCompressionHandler(me.handler, me);
            }
        }

        HttpHandler resolved = resolveHandlers(routingRestHandler, websocketHandler, staticHandler, mappedEndpoints);

        HttpHandler root = wrapRootInterceptorHandler(resolved, rootInterceptors);
        HttpHandler handler = wrapRequestDump(root, httpTracer);
//        handler = wrapServerName(handler);

        return Handlers.gracefulShutdown(handler);
    }
1268876
private void createDirAndFile(Path path) throws IOException {
			// create dir and file first if dir/file not exist
			File file = new File(path.toAbsolutePath().toString());
			File dir = file.getParentFile();
			if (dir != null && !dir.exists()) {
				dir.mkdirs();
			}
			if (!file.exists()) {
				file.createNewFile();
			}
	}
634822
public Http4K publishFileSystem( String hostName, String urlPath, int port, File root ) {
        if ( ! root.exists() )
            root.mkdirs();
        if ( ! root.isDirectory() ) {
            throw new RuntimeException("root must be an existing direcory:"+root.getAbsolutePath());
        }
        Pair<PathHandler, Undertow> server = getServer(port, hostName);
        server.car().addPrefixPath(urlPath, new ResourceHandler(new FileResourceManager(root,100)));
        return this;
    }
751732
private DirectoryService createDirectoryService() {

        final DirectoryServiceFactory factory = new DefaultDirectoryServiceFactory();
        try {
            factory.init("scribble");
            return factory.getDirectoryService();
        } catch (Exception e) { //NOSONAR

            throw new AssertionError("Unable to create directory service", e);
        }
    }
66959
@SuppressWarnings("static-method")
	protected ClassLoader createClassLoader(Iterable<File> jarsAndFolders, ClassLoader parentClassLoader) {
		return new URLClassLoader(Iterables.toArray(Iterables.transform(jarsAndFolders, from -> {
			try {
				final URL url = from.toURI().toURL();
				assert url != null;
				return url;
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}), URL.class), parentClassLoader);
	}
868383
public static TomcatServiceBuilder forClassPath(Class<?> clazz, String docBaseOrJarRoot) {
        requireNonNull(clazz, "clazz");
        requireNonNull(docBaseOrJarRoot, "docBaseOrJarRoot");

        final ProtectionDomain pd = clazz.getProtectionDomain();
        if (pd == null) {
            throw new IllegalArgumentException(clazz + " does not have a protection domain.");
        }
        final CodeSource cs = pd.getCodeSource();
        if (cs == null) {
            throw new IllegalArgumentException(clazz + " does not have a code source.");
        }
        final URL url = cs.getLocation();
        if (url == null) {
            throw new IllegalArgumentException(clazz + " does not have a location.");
        }

        if (!"file".equalsIgnoreCase(url.getProtocol())) {
            throw new IllegalArgumentException(clazz + " is not on a file system: " + url);
        }

        File f;
        try {
            f = new File(url.toURI());
        } catch (URISyntaxException ignored) {
            f = new File(url.getPath());
        }

        if (TomcatUtil.isZip(f.toPath())) {
            return new TomcatServiceBuilder(f.toPath(), docBaseOrJarRoot);
        }

        f = fileSystemDocBase(f, docBaseOrJarRoot);

        if (!f.isDirectory()) {
            throw new IllegalArgumentException(f + " is not a directory.");
        }

        return forFileSystem(f.toPath());
    }