/*
 *  Licensed to the Apache Software Foundation (ASF) under one or more
 *  contributor license agreements.  See the NOTICE file distributed with
 *  this work for additional information regarding copyright ownership.
 *  The ASF licenses this file to You under the Apache License, Version 2.0
 *  (the "License"); you may not use this file except in compliance with
 *  the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

package org.apache.tomcat.jni;

Directory
Author:Mladen Turk
Deprecated: The scope of the APR/Native Library will be reduced in Tomcat 10.1.x onwards to only those components required to provide OpenSSL integration with the NIO and NIO2 connectors.
/** Directory * * @author Mladen Turk * * @deprecated The scope of the APR/Native Library will be reduced in Tomcat * 10.1.x onwards to only those components required to provide * OpenSSL integration with the NIO and NIO2 connectors. */
@Deprecated public class Directory {
Create a new directory on the file system.
Params:
  • path – the path for the directory to be created. (use / on all systems)
  • perm – Permissions for the new directory.
  • pool – the pool to use.
Returns:the operation result
/** * Create a new directory on the file system. * @param path the path for the directory to be created. (use / on all systems) * @param perm Permissions for the new directory. * @param pool the pool to use. * @return the operation result */
public static native int make(String path, int perm, long pool);
Creates a new directory on the file system, but behaves like 'mkdir -p'. Creates intermediate directories as required. No error will be reported if PATH already exists.
Params:
  • path – the path for the directory to be created. (use / on all systems)
  • perm – Permissions for the new directory.
  • pool – the pool to use.
Returns:the operation result
/** * Creates a new directory on the file system, but behaves like * 'mkdir -p'. Creates intermediate directories as required. No error * will be reported if PATH already exists. * @param path the path for the directory to be created. (use / on all systems) * @param perm Permissions for the new directory. * @param pool the pool to use. * @return the operation result */
public static native int makeRecursive(String path, int perm, long pool);
Remove directory from the file system.
Params:
  • path – the path for the directory to be removed. (use / on all systems)
  • pool – the pool to use.
Returns:the operation result
/** * Remove directory from the file system. * @param path the path for the directory to be removed. (use / on all systems) * @param pool the pool to use. * @return the operation result */
public static native int remove(String path, long pool);
Find an existing directory suitable as a temporary storage location.
Params:
  • pool – The pool to use for any necessary allocations.
Returns:The temp directory. This function uses an algorithm to search for a directory that an an application can use for temporary storage. Once such a directory is found, that location is cached by the library. Thus, callers only pay the cost of this algorithm once if that one time is successful.
/** * Find an existing directory suitable as a temporary storage location. * @param pool The pool to use for any necessary allocations. * @return The temp directory. * * This function uses an algorithm to search for a directory that an * an application can use for temporary storage. Once such a * directory is found, that location is cached by the library. Thus, * callers only pay the cost of this algorithm once if that one time * is successful. */
public static native String tempGet(long pool);
Open the specified directory.
Params:
  • dirname – The full path to the directory (use / on all systems)
  • pool – The pool to use.
Throws:
  • Error – An error occurred
Returns:The opened directory descriptor.
/** * Open the specified directory. * @param dirname The full path to the directory (use / on all systems) * @param pool The pool to use. * @return The opened directory descriptor. * @throws Error An error occurred */
public static native long open(String dirname, long pool) throws Error;
close the specified directory.
Params:
  • thedir – the directory descriptor to close.
Returns:the operation result
/** * close the specified directory. * @param thedir the directory descriptor to close. * @return the operation result */
public static native int close(long thedir);
Rewind the directory to the first entry.
Params:
  • thedir – the directory descriptor to rewind.
Returns:the operation result
/** * Rewind the directory to the first entry. * @param thedir the directory descriptor to rewind. * @return the operation result */
public static native int rewind(long thedir);
Read the next entry from the specified directory.
Params:
  • finfo – the file info structure and filled in by apr_dir_read
  • wanted – The desired apr_finfo_t fields, as a bit flag of APR_FINFO_ values
  • thedir – the directory descriptor returned from apr_dir_open No ordering is guaranteed for the entries read.
Returns:the operation result
/** * Read the next entry from the specified directory. * @param finfo the file info structure and filled in by apr_dir_read * @param wanted The desired apr_finfo_t fields, as a bit flag of APR_FINFO_ values * @param thedir the directory descriptor returned from apr_dir_open * No ordering is guaranteed for the entries read. * @return the operation result */
public static native int read(FileInfo finfo, int wanted, long thedir); }