📄 file.java
字号:
* 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 direct Byte buffer to store the data to.
* @param offset Start offset in buf
* @param nbytes The number of bytes to read.
* @return the number of bytes read.
*/
public static native int readb(long thefile, ByteBuffer buf, int offset, int nbytes);
/**
* Read data from the specified file, ensuring that the buffer is filled
* before returning.
*
* 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, then the process/thread will block until it is
* available or EOF is reached. If a char was put back into the
* stream via ungetc, it will be the first character returned.
*
* It is possible for both bytes to be read and an error to be
* returned. And if *bytes_read is less than nbytes, an accompanying
* error is _always_ 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 readFull(long thefile, byte[] buf, int offset, int nbytes);
/**
* Read data from the specified file, ensuring that the buffer is filled
* before returning.
*
* 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, then the process/thread will block until it is
* available or EOF is reached. If a char was put back into the
* stream via ungetc, it will be the first character returned.
*
* It is possible for both bytes to be read and an error to be
* returned. And if *bytes_read is less than nbytes, an accompanying
* error is _always_ returned.
*
* APR_EINTR is never returned.
* @param thefile The file descriptor to read from.
* @param buf The direct ByteBuffer to store the data to.
* @param offset Start offset in buf
* @param nbytes The number of bytes to read.
* @return the number of bytes read.
*/
public static native int readFullb(long thefile, ByteBuffer buf, int offset, int nbytes);
/**
* Read a string from the specified file.
* The buffer will be NUL-terminated if any characters are stored.
* @param buf The buffer to store the string in.
* @param offset Start offset in buf
* @param thefile The file descriptor to read from
*/
public static native int gets(byte[] buf, int offset, long thefile);
/**
* Read a character from the specified file.
* @param thefile The file descriptor to read from
* @return The readed character
*/
public static native int getc(long thefile)
throws Error;
/**
* Are we at the end of the file
* @param fptr The apr file we are testing.
* @return Returns APR_EOF if we are at the end of file, APR_SUCCESS otherwise.
*/
public static native int eof(long fptr);
/**
* return the file name of the current file.
* @param thefile The currently open file.
*/
public static native String nameGet(long thefile);
/**
* Set the specified file's permission bits.
* <br /><b>Warning :</b> Some platforms may not be able to apply all of the
* available permission bits; APR_INCOMPLETE will be returned if some
* permissions are specified which could not be set.
* <br /><b>Warning :</b> Platforms which do not implement this feature will return
* APR_ENOTIMPL.
* @param fname The file (name) to apply the permissions to.
* @param perms The permission bits to apply to the file.
*
*/
public static native int permsSet(String fname, int perms);
/**
* Set attributes of the specified file.
* This function should be used in preference to explict manipulation
* of the file permissions, because the operations to provide these
* attributes are platform specific and may involve more than simply
* setting permission bits.
* <br /><b>Warning :</b> Platforms which do not implement this feature will return
* APR_ENOTIMPL.
* @param fname The full path to the file (using / on all systems)
* @param attributes Or'd combination of
* <PRE>
* APR_FILE_ATTR_READONLY - make the file readonly
* APR_FILE_ATTR_EXECUTABLE - make the file executable
* APR_FILE_ATTR_HIDDEN - make the file hidden
* </PRE>
* @param mask Mask of valid bits in attributes.
* @param pool the pool to use.
*/
public static native int attrsSet(String fname, int attributes, int mask, long pool);
/**
* Set the mtime of the specified file.
* <br /><b>Warning :</b> Platforms which do not implement this feature will return
* APR_ENOTIMPL.
* @param fname The full path to the file (using / on all systems)
* @param mtime The mtime to apply to the file in microseconds
* @param pool The pool to use.
*/
public static native int mtimeSet(String fname, long mtime, long pool);
/**
* Establish a lock on the specified, open file. The lock may be advisory
* or mandatory, at the discretion of the platform. The lock applies to
* the file as a whole, rather than a specific range. Locks are established
* on a per-thread/process basis; a second lock by the same thread will not
* block.
* @param thefile The file to lock.
* @param type The type of lock to establish on the file.
*/
public static native int lock(long thefile, int type);
/**
* Remove any outstanding locks on the file.
* @param thefile The file to unlock.
*/
public static native int unlock(long thefile);
/**
* Retrieve the flags that were passed into apr_file_open()
* when the file was opened.
* @param file The file to retrive flags.
* @return the flags
*/
public static native int flagsGet(long file);
/**
* Truncate the file's length to the specified offset
* @param fp The file to truncate
* @param offset The offset to truncate to.
*/
public static native int trunc(long fp, long offset);
/**
* Create an anonymous pipe.
* @param io io[0] The file descriptors to use as input to the pipe.
* io[1] The file descriptor to use as output from the pipe.
* @param pool The pool to operate on.
*/
public static native int pipeCreate(long [] io, long pool);
/**
* Get the timeout value for a pipe or manipulate the blocking state.
* @param thepipe The pipe we are getting a timeout for.
* @return The current timeout value in microseconds.
*/
public static native long pipeTimeoutGet(long thepipe)
throws Error;
/**
* Set the timeout value for a pipe or manipulate the blocking state.
* @param thepipe The pipe we are setting a timeout on.
* @param timeout The timeout value in microseconds. Values < 0 mean wait
* forever, 0 means do not wait at all.
*/
public static native int pipeTimeoutSet(long thepipe, long timeout);
/**
* Duplicate the specified file descriptor.
* @param newFile The file to duplicate.
* newFile must point to a valid apr_file_t, or point to NULL.
* @param oldFile The file to duplicate.
* @param pool The pool to use for the new file.
* @return Duplicated file structure.
*/
public static native long dup(long newFile, long oldFile, long pool)
throws Error;
/**
* Duplicate the specified file descriptor and close the original.
* @param newFile The old file that is to be closed and reused.
* newFile MUST point at a valid apr_file_t. It cannot be NULL.
* @param oldFile The file to duplicate.
* @param pool The pool to use for the new file.
* @return Status code.
*/
public static native int dup2(long newFile, long oldFile, long pool);
/**
* Get the specified file's stats. The file is specified by filename,
* instead of using a pre-opened file.
* @param finfo Where to store the information about the file, which is
* never touched if the call fails.
* @param fname The name of the file to stat.
* @param wanted The desired apr_finfo_t fields, as a bit flag of APR_FINFO_ values
* @param pool the pool to use to allocate the new file.
*/
public static native int stat(FileInfo finfo, String fname, int wanted, long pool);
/**
* Get the specified file's stats.
* @param finfo Where to store the information about the file.
* @param wanted The desired apr_finfo_t fields, as a bit flag of APR_FINFO_ values
* @param thefile The file to get information about.
*/
public static native int infoGet(FileInfo finfo, int wanted, long thefile);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -