Source Code Cross Referenced for FileSystem.java in  » 6.0-JDK-Modules » j2me » java » io » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » j2me » java.io 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * @(#)FileSystem.java	1.14 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 java.io;
029:
030:        /**
031:         * Package-private abstract class for the local filesystem abstraction.
032:         */
033:
034:        abstract class FileSystem {
035:
036:            /**
037:             * Return the FileSystem object representing this platform's local
038:             * filesystem.
039:             */
040:            public static native FileSystem getFileSystem();
041:
042:            /* -- Normalization and construction -- */
043:
044:            /**
045:             * Return the local filesystem's name-separator character.
046:             */
047:            public abstract char getSeparator();
048:
049:            /**
050:             * Return the local filesystem's path-separator character.
051:             */
052:            public abstract char getPathSeparator();
053:
054:            /**
055:             * Convert the given pathname string to normal form.  If the string is
056:             * already in normal form then it is simply returned.
057:             */
058:            public abstract String normalize(String path);
059:
060:            /**
061:             * Compute the length of this pathname string's prefix.  The pathname
062:             * string must be in normal form.
063:             */
064:            public abstract int prefixLength(String path);
065:
066:            /**
067:             * Resolve the child pathname string against the parent.
068:             * Both strings must be in normal form, and the result
069:             * will be in normal form.
070:             */
071:            public abstract String resolve(String parent, String child);
072:
073:            /**
074:             * Return the parent pathname string to be used when the parent-directory
075:             * argument in one of the two-argument File constructors is the empty
076:             * pathname.
077:             */
078:            public abstract String getDefaultParent();
079:
080:            /**
081:             * Post-process the given URI path string if necessary.  This is used on
082:             * win32, e.g., to transform "/c:/foo" into "c:/foo".  The path string
083:             * still has slash separators; code in the File class will translate them
084:             * after this method returns.
085:             */
086:            public abstract String fromURIPath(String path);
087:
088:            /* -- Path operations -- */
089:
090:            /**
091:             * Tell whether or not the given abstract pathname is absolute.
092:             */
093:            public abstract boolean isAbsolute(File f);
094:
095:            /**
096:             * Resolve the given abstract pathname into absolute form.  Invoked by the
097:             * getAbsolutePath and getCanonicalPath methods in the File class.
098:             */
099:            public abstract String resolve(File f);
100:
101:            public abstract String canonicalize(String path) throws IOException;
102:
103:            /* -- Attribute accessors -- */
104:
105:            /* Constants for simple boolean attributes */
106:            public static final int BA_EXISTS = 0x01;
107:            public static final int BA_REGULAR = 0x02;
108:            public static final int BA_DIRECTORY = 0x04;
109:            public static final int BA_HIDDEN = 0x08;
110:
111:            /**
112:             * Return the simple boolean attributes for the file or directory denoted
113:             * by the given abstract pathname, or zero if it does not exist or some
114:             * other I/O error occurs.
115:             */
116:            public abstract int getBooleanAttributes(File f);
117:
118:            /**
119:             * Check whether the file or directory denoted by the given abstract
120:             * pathname may be accessed by this process.  If the second argument is
121:             * <code>false</code>, then a check for read access is made; if the second
122:             * argument is <code>true</code>, then a check for write (not read-write)
123:             * access is made.  Return false if access is denied or an I/O error
124:             * occurs.
125:             */
126:            public abstract boolean checkAccess(File f, boolean write);
127:
128:            /**
129:             * Return the time at which the file or directory denoted by the given
130:             * abstract pathname was last modified, or zero if it does not exist or
131:             * some other I/O error occurs.
132:             */
133:            public abstract long getLastModifiedTime(File f);
134:
135:            /**
136:             * Return the length in bytes of the file denoted by the given abstract
137:             * pathname, or zero if it does not exist, is a directory, or some other
138:             * I/O error occurs.
139:             */
140:            public abstract long getLength(File f);
141:
142:            /* -- File operations -- */
143:
144:            /**
145:             * Create a new empty file with the given pathname.  Return
146:             * <code>true</code> if the file was created and <code>false</code> if a
147:             * file or directory with the given pathname already exists.  Throw an
148:             * IOException if an I/O error occurs.
149:             */
150:            public abstract boolean createFileExclusively(String pathname)
151:                    throws IOException;
152:
153:            /**
154:             * Delete the file or directory denoted by the given abstract pathname,
155:             * returning <code>true</code> if and only if the operation succeeds.
156:             */
157:            public abstract boolean delete(File f);
158:
159:            /**
160:             * Arrange for the file or directory denoted by the given abstract
161:             * pathname to be deleted when the VM exits, returning <code>true</code> if
162:             * and only if the operation succeeds.
163:             */
164:            public abstract boolean deleteOnExit(File f);
165:
166:            /**
167:             * List the elements of the directory denoted by the given abstract
168:             * pathname.  Return an array of strings naming the elements of the
169:             * directory if successful; otherwise, return <code>null</code>.
170:             */
171:            public abstract String[] list(File f);
172:
173:            /**
174:             * Create a new directory denoted by the given abstract pathname,
175:             * returning <code>true</code> if and only if the operation succeeds.
176:             */
177:            public abstract boolean createDirectory(File f);
178:
179:            /**
180:             * Rename the file or directory denoted by the first abstract pathname to
181:             * the second abstract pathname, returning <code>true</code> if and only if
182:             * the operation succeeds.
183:             */
184:            public abstract boolean rename(File f1, File f2);
185:
186:            /**
187:             * Set the last-modified time of the file or directory denoted by the
188:             * given abstract pathname, returning <code>true</code> if and only if the
189:             * operation succeeds.
190:             */
191:            public abstract boolean setLastModifiedTime(File f, long time);
192:
193:            /**
194:             * Mark the file or directory denoted by the given abstract pathname as
195:             * read-only, returning <code>true</code> if and only if the operation
196:             * succeeds.
197:             */
198:            public abstract boolean setReadOnly(File f);
199:
200:            /* -- Filesystem interface -- */
201:
202:            /**
203:             * List the available filesystem roots.
204:             */
205:            public abstract File[] listRoots();
206:
207:            /* -- Basic infrastructure -- */
208:
209:            /**
210:             * Compare two abstract pathnames lexicographically.
211:             */
212:            public abstract int compare(File f1, File f2);
213:
214:            /**
215:             * Compute the hash code of an abstract pathname.
216:             */
217:            public abstract int hashCode(File f);
218:
219:            // Flags for enabling/disabling performance optimizations for file
220:            // name canonicalization
221:            static boolean useCanonCaches = true;
222:            static boolean useCanonPrefixCache = true;
223:
224:            private static boolean getBooleanProperty(String prop,
225:                    boolean defaultVal) {
226:                String val = System.getProperty("sun.io.useCanonCaches");
227:                if (val == null)
228:                    return defaultVal;
229:                if (val.equalsIgnoreCase("true")) {
230:                    return true;
231:                } else {
232:                    return false;
233:                }
234:            }
235:
236:            static {
237:                useCanonCaches = getBooleanProperty("sun.io.useCanonCaches",
238:                        useCanonCaches);
239:                useCanonPrefixCache = getBooleanProperty(
240:                        "sun.io.useCanonPrefixCache", useCanonPrefixCache);
241:            }
242:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.