JAVA中,文件操作类(File/FileOutputStream等)

来源:互联网 发布:淘宝上下架在哪里设置 编辑:程序博客网 时间:2024/06/15 08:47

File->Object

public File(String path) public File(String dirPath, String name)public File(File dir, String name) public long length()public boolean delete()public boolean exists() public boolean mkdir()public boolean mkdirs() public String getName()public String getParent()public File getParentFile()public boolean renameTo(File newPath)public boolean canExecute()public boolean canRead()public boolean canWrite()public boolean isDirectory()public boolean isFile()public boolean isHidden() public long lastModified()public boolean setLastModified(long time)public long getTotalSpace()public long getUsableSpace()public long getFreeSpace() 

FileOutputStream->OutputStream->Object

public FileOutputStream(File file) throws FileNotFoundExceptionpublic FileOutputStream(File file, boolean append) throws FileNotFoundExceptionpublic FileOutputStream(FileDescriptor fd)public FileOutputStream(String path) throws FileNotFoundExceptionpublic FileOutputStream(String path, boolean append) throws FileNotFoundExceptionpublic final FileDescriptor getFD() throws IOExceptionpublic void write(byte[] buffer, int byteOffset, int byteCount) throws IOException public void write(int oneByte) throws IOException public void close() throws IOException

FileInputStream->InputStream->Object

public FileInputStream(File file) throws FileNotFoundExceptionpublic FileInputStream(String path) throws FileNotFoundException public FileInputStream(FileDescriptor fd)public int available() throws IOException public final FileDescriptor getFD() throws IOExceptionpublic int read() throws IOExceptionpublic int read(byte[] buffer, int byteOffset, int byteCount) throws IOExceptionpublic long skip(long byteCount) throws IOExceptionpublic void close() throws IOException