001: /*
002: * @(#)FileFileIO.java 1.12 06/10/10
003: *
004: * Copyright 1990-2006 Sun Microsystems, Inc. All Rights Reserved.
005: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
006: *
007: * This program is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU General Public License version
009: * 2 only, as published by the Free Software Foundation.
010: *
011: * This program is distributed in the hope that it will be useful, but
012: * WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * General Public License version 2 for more details (a copy is
015: * included at /legal/license.txt).
016: *
017: * You should have received a copy of the GNU General Public License
018: * version 2 along with this work; if not, write to the Free Software
019: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA
021: *
022: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
023: * Clara, CA 95054 or visit www.sun.com if you need additional
024: * information or have any questions.
025: *
026: */
027:
028: package sun.io;
029:
030: import java.io.File;
031: import java.io.InputStream;
032: import java.io.OutputStream;
033: import java.io.IOException;
034:
035: public class FileFileIO extends sun.io.FileIO {
036: File file;
037:
038: protected FileFileIO(String path) {
039: super (path);
040: file = new File(path);
041: }
042:
043: public FileFileIO(String path, String name) {
044: super (path, name);
045: file = new File(path, name);
046: }
047:
048: public FileFileIO(FileIO dir, String name) {
049: this (dir.getPath(), name);
050: }
051:
052: public InputStream getInputStream() throws IOException {
053: return new java.io.FileInputStream(this .path);
054: }
055:
056: public OutputStream getOutputStream() throws IOException {
057: return new java.io.FileOutputStream(this .path);
058: }
059:
060: public String canonPath(String path) throws IOException {
061: return file.getCanonicalPath();
062: }
063:
064: public boolean exists() {
065: return file.exists();
066: }
067:
068: public boolean canWrite() {
069: return file.canWrite();
070: }
071:
072: public boolean canRead() {
073: return file.canRead();
074: }
075:
076: public boolean isFile() {
077: return file.isFile();
078: }
079:
080: public boolean isDirectory() {
081: return file.isDirectory();
082: }
083:
084: public boolean isAbsolute() {
085: return file.isAbsolute();
086: }
087:
088: public long lastModified() {
089: return file.lastModified();
090: }
091:
092: public long length() {
093: return file.length();
094: }
095:
096: public String[] list() {
097: return file.list();
098: }
099:
100: public boolean delete() {
101: return file.delete();
102: }
103:
104: public boolean mkdir() {
105: return file.mkdir();
106: }
107: }
|