📄 file.java
字号:
/**
* Open a temporary file
* @param templ The template to use when creating a temp file.
* @param flags The flags to open the file with. If this is zero,
* the file is opened with
* APR_CREATE | APR_READ | APR_WRITE | APR_EXCL | APR_DELONCLOSE
* @param pool The pool to allocate the file out of.
* @return The apr file to use as a temporary file.
*
* This function generates a unique temporary file name from template.
* The last six characters of template must be XXXXXX and these are replaced
* with a string that makes the filename unique. Since it will be modified,
* template must not be a string constant, but should be declared as a character
* array.
*
*/
public static native long mktemp(String templ, int flags, long pool)
throws Error;
/**
* Delete the specified file.
* @param path The full path to the file (using / on all systems)
* @param pool The pool to use.
* If the file is open, it won't be removed until all
* instances are closed.
*/
public static native int remove(String path, long pool);
/**
* Rename the specified file.
* <br /><b>Warning :</b> If a file exists at the new location, then it will be
* overwritten. Moving files or directories across devices may not be
* possible.
* @param fromPath The full path to the original file (using / on all systems)
* @param toPath The full path to the new file (using / on all systems)
* @param pool The pool to use.
*/
public static native int rename(String fromPath, String toPath, long pool);
/**
* Copy the specified file to another file.
* The new file does not need to exist, it will be created if required.
* <br /><b>Warning :</b> If the new file already exists, its contents will be overwritten.
* @param fromPath The full path to the original file (using / on all systems)
* @param toPath The full path to the new file (using / on all systems)
* @param perms Access permissions for the new file if it is created.
* In place of the usual or'd combination of file permissions, the
* value APR_FILE_SOURCE_PERMS may be given, in which case the source
* file's permissions are copied.
* @param pool The pool to use.
*/
public static native int copy(String fromPath, String toPath, int perms, long pool);
/**
* Append the specified file to another file.
* The new file does not need to exist, it will be created if required.
* @param fromPath The full path to the source file (use / on all systems)
* @param toPath The full path to the destination file (use / on all systems)
* @param perms Access permissions for the destination file if it is created.
* In place of the usual or'd combination of file permissions, the
* value APR_FILE_SOURCE_PERMS may be given, in which case the source
* file's permissions are copied.
* @param pool The pool to use.
*/
public static native int append(String fromPath, String toPath, int perms, long pool);
/**
* Write the string into the specified file.
* @param str The string to write. Must be NUL terminated!
* @param thefile The file descriptor to write to
*/
public static native int puts(byte [] str, long thefile);
/**
* Move the read/write file offset to a specified byte within a file.
* @param thefile The file descriptor
* @param where How to move the pointer, one of:
* <PRE>
* APR_SET -- set the offset to offset
* APR_CUR -- add the offset to the current position
* APR_END -- add the offset to the current file size
* </PRE>
* @param offset The offset to move the pointer to.
* @return Offset the pointer was actually moved to.
*/
public static native long seek(long thefile, int where, long offset)
throws Error;
/**
* Write a character into the specified file.
* @param ch The character to write.
* @param thefile The file descriptor to write to
*/
public static native int putc(byte ch, long thefile);
/**
* Put a character back onto a specified stream.
* @param ch The character to write.
* @param thefile The file descriptor to write to
*/
public static native int ungetc(byte ch, long thefile);
/**
* Write data to the specified file.
*
* Write will write up to the specified number of
* bytes, but never more. If the OS cannot write that many bytes, it
* will write as many as it can. The third argument is modified to
* reflect the * number of bytes written.
*
* It is possible for both bytes to be written and an error to
* be returned. APR_EINTR is never returned.
* @param thefile The file descriptor to write to.
* @param buf The buffer which contains the data.
* @param offset Start offset in buf
* @param nbytes The number of bytes to write; (-1) for full array.
* @return The number of bytes written.
*/
public static native int write(long thefile, byte[] buf, int offset, int nbytes);
/**
* Write data to the specified file.
*
* Write will write up to the specified number of
* bytes, but never more. If the OS cannot write that many bytes, it
* will write as many as it can. The third argument is modified to
* reflect the * number of bytes written.
*
* It is possible for both bytes to be written and an error to
* be returned. APR_EINTR is never returned.
* @param thefile The file descriptor to write to.
* @param buf The direct Byte buffer which contains the data.
* @param offset Start offset in buf
* @param nbytes The number of bytes to write
* @return The number of bytes written.
*/
public static native int writeb(long thefile, ByteBuffer buf, int offset, int nbytes);
/**
* Write data to the specified file, ensuring that all of the data is
* written before returning.
*
* Write will write up to the specified number of
* bytes, but never more. If the OS cannot write that many bytes, the
* process/thread will block until they can be written. Exceptional
* error such as "out of space" or "pipe closed" will terminate with
* an error.
*
* It is possible for both bytes to be written and an error to
* be returned. And if *bytes_written is less than nbytes, an
* accompanying error is _always_ returned.
*
* APR_EINTR is never returned.
* @param thefile The file descriptor to write to.
* @param buf The buffer which contains the data.
* @param offset Start offset in buf
* @param nbytes The number of bytes to write; (-1) for full array.
* @return The number of bytes written.
*/
public static native int writeFull(long thefile, byte[] buf, int offset, int nbytes);
/**
* Write data to the specified file, ensuring that all of the data is
* written before returning.
*
* Write will write up to the specified number of
* bytes, but never more. If the OS cannot write that many bytes, the
* process/thread will block until they can be written. Exceptional
* error such as "out of space" or "pipe closed" will terminate with
* an error.
*
* It is possible for both bytes to be written and an error to
* be returned. And if *bytes_written is less than nbytes, an
* accompanying error is _always_ returned.
*
* APR_EINTR is never returned.
* @param thefile The file descriptor to write to.
* @param buf The direct ByteBuffer which contains the data.
* @param offset Start offset in buf
* @param nbytes The number of bytes to write.
* @return The number of bytes written.
*/
public static native int writeFullb(long thefile, ByteBuffer buf, int offset, int nbytes);
/**
* Write data from aray of byte arrays to the specified file.
*
* It is possible for both bytes to be written and an error to
* be returned. APR_EINTR is never returned.
*
* apr_file_writev is available even if the underlying
* operating system doesn't provide writev().
* @param thefile The file descriptor to write to.
* @param vec The array from which to get the data to write to the file.
* @return The number of bytes written.
*/
public static native int writev(long thefile, byte[][] vec);
/**
* Write data from aray of byte arrays to the specified file,
* ensuring that all of the data is written before returning.
*
* writevFull is available even if the underlying
* operating system doesn't provide writev().
* @param thefile The file descriptor to write to.
* @param vec The array from which to get the data to write to the file.
* @return The number of bytes written.
*/
public static native int writevFull(long thefile, byte[][] vec);
/**
* Read data from the specified file.
*
* apr_file_read will read up to the specified number of
* bytes, but never more. If there isn't enough data to fill that
* number of bytes, all of the available data is read. The third
* argument is modified to reflect the number of bytes read. If a
* char was put back into the stream via ungetc, it will be the first
* character returned.
*
* It is not possible for both bytes to be read and an APR_EOF
* or other error to be returned. APR_EINTR is never returned.
* @param thefile The file descriptor to read from.
* @param buf The buffer to store the data to.
* @param offset Start offset in buf
* @param nbytes The number of bytes to read (-1) for full array.
* @return the number of bytes read.
*/
public static native int read(long thefile, byte[] buf, int offset, int nbytes);
/**
* Read data from the specified file.
*
* apr_file_read will read up to the specified number of
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -