You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2011/04/01 11:52:28 UTC

svn commit: r1087634 - /commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FileDescriptorFactory.java

Author: mturk
Date: Fri Apr  1 09:52:28 2011
New Revision: 1087634

URL: http://svn.apache.org/viewvc?rev=1087634&view=rev
Log:
Add support for creating FileDescriptor objects

Added:
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FileDescriptorFactory.java   (with props)

Added: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FileDescriptorFactory.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FileDescriptorFactory.java?rev=1087634&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FileDescriptorFactory.java (added)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FileDescriptorFactory.java Fri Apr  1 09:52:28 2011
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.commons.runtime.io;
+import java.io.FileDescriptor;
+
+
+class FileDescriptorFactory
+{
+    private FileDescriptorFactory()
+    {
+        // No instance.
+    }
+
+    private static native FileDescriptor new0(int fd, long fh)
+        throws InstantiationException, OutOfMemoryError;
+    public static FileDescriptor newFileDescriptor(int fd, long handle)
+        throws InstantiationException, OutOfMemoryError
+    {
+        return new0(fd, handle);
+    }
+
+    public static FileDescriptor newFileDescriptor(int fd)
+        throws InstantiationException, OutOfMemoryError
+    {
+        return newFileDescriptor(fd, 0);
+    }
+
+    public static FileDescriptor newFileDescriptor(long handle)
+        throws InstantiationException, OutOfMemoryError
+    {
+        return newFileDescriptor(-1, handle);
+    }
+}

Propchange: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FileDescriptorFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native