Showing the changes to java/pkg/java/io/FileDescriptor.java (1 of 4 files). Show all
Unified · Split
| @@ -0,0 +1,86 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved. | |
| 3 | + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
| 4 | + * | |
| 5 | + * This code is free software; you can redistribute it and/or modify it | |
| 6 | + * under the terms of the GNU General Public License version 2 only, as | |
| 7 | + * published by the Free Software Foundation. Oracle designates this | |
| 8 | + * particular file as subject to the "Classpath" exception as provided | |
| 9 | + * by Oracle in the LICENSE file that accompanied this code. | |
| 10 | + * | |
| 11 | + * This code is distributed in the hope that it will be useful, but WITHOUT | |
| 12 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| 13 | + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
| 14 | + * version 2 for more details (a copy is included in the LICENSE file that | |
| 15 | + * accompanied this code). | |
| 16 | + * | |
| 17 | + * You should have received a copy of the GNU General Public License version | |
| 18 | + * 2 along with this work; if not, write to the Free Software Foundation, | |
| 19 | + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
| 20 | + * | |
| 21 | + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
| 22 | + * or visit www.oracle.com if you need additional information or have any | |
| 23 | + * questions. | |
| 24 | + */ | |
| 25 | +package java.io; | |
| 26 | + | |
| 27 | +//import java.io.*; | |
| 28 | +//import java.util.Properties; | |
| 29 | +//import java.util.PropertyPermission; | |
| 30 | +//import java.util.StringTokenizer; | |
| 31 | +//import java.security.AccessController; | |
| 32 | +//import java.security.PrivilegedAction; | |
| 33 | +//import java.security.AllPermission; | |
| 34 | +//import java.nio.channels.Channel; | |
| 35 | +//import java.nio.channels.spi.SelectorProvider; | |
| 36 | +//import sun.nio.ch.Interruptible; | |
| 37 | +//import sun.reflect.Reflection; | |
| 38 | +//import sun.security.util.SecurityConstants; | |
| 39 | +//import sun.reflect.annotation.AnnotationType; | |
| 40 | + | |
| 41 | +/** | |
| 42 | + * The <code>FileDescriptor</code> class is the internal to Inferno's jvm | |
| 43 | + * class representing internal file descriptor. | |
| 44 | + * | |
| 45 | + * Mainly provides in, out and err file descriptors. | |
| 46 | + * | |
| 47 | + * @author kabbi | |
| 48 | + */ | |
| 49 | +public final class FileDescriptor { | |
| 50 | + | |
| 51 | + public static FileDescriptor in = new FileDescriptor(); | |
| 52 | + | |
| 53 | + public static FileDescriptor out = new FileDescriptor(); | |
| 54 | + | |
| 55 | + public static FileDescriptor err = new FileDescriptor(); | |
| 56 | + | |
| 57 | + static { | |
| 58 | + in = initSystemFD(in, 0); | |
| 59 | + out = initSystemFD(out, 1); | |
| 60 | + err = initSystemFD(err, 2); | |
| 61 | + } | |
| 62 | + | |
| 63 | + /** Don't let anyone instantiate this class */ | |
| 64 | + private FileDescriptor() { | |
| 65 | + } | |
| 66 | + | |
| 67 | + /** | |
| 68 | + * Init some FileDescriptor object with system numeric fd number | |
| 69 | + * | |
| 70 | + * @param fd FileDescriptor object | |
| 71 | + * @param number system fd index | |
| 72 | + */ | |
| 73 | + public final static native FileDescriptor initSystemFD(FileDescriptor fd, int number); | |
| 74 | + | |
| 75 | + /** | |
| 76 | + * Check if this file descriptor is valid. | |
| 77 | + */ | |
| 78 | + public final native boolean valid(); | |
| 79 | + | |
| 80 | + /* | |
| 81 | + * Flush all the buffers and wait till every operation is completed. | |
| 82 | + * Means nothing in Inferno, as all the operations are synchronous. | |
| 83 | + */ | |
| 84 | + public final native void sync(); | |
| 85 | + | |
| 86 | +} | |