Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8230073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:00:53+00:00 2026-06-07T17:00:53+00:00

JavaDoc for java.io.FileDescriptor.FileDescriptor() says: Constructs an (invalid) FileDescriptor object. If there is no purpose

  • 0

JavaDoc for java.io.FileDescriptor.FileDescriptor() says:

Constructs an (invalid) FileDescriptor object.

If there is no purpose for the constructor, why is it’s access level not declared to be package-private?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T17:00:54+00:00Added an answer on June 7, 2026 at 5:00 pm

    This constructor is public because it is used outside of java.io.

    Classes using new FileDescriptor() in JRE 7u4 Linux x86:

    java.io.FileInputStream
    java.io.FileOutputStream
    java.io.RandomAccessFile
    
    java.lang.UNIXProcess
    java.net.AbstractPlainDatagramSocketImpl
    java.net.AbstractPlainSocketImpl
    java.net.ServerSocket
    
    sun.net.sdp.SdpSupport
    sun.nio.ch.FileChannelImpl
    sun.nio.ch.FileDispatcherImpl
    sun.nio.ch.IOUtil
    sun.nio.ch.PipeImpl
    sun.nio.ch.SctpServerChannelImpl
    sun.nio.ch.ServerSocketChannelImpl
    sun.nio.ch.UnixAsynchronousServerSocketChannelImpl
    sun.nio.fs.UnixChannelFactory
    

    There is a sun.misc.SharedSecrets method that allows the programmer to change the state of a FileDescriptor to a valid one (this snippet found in java.io.FileDescriptor):

      static {
            sun.misc.SharedSecrets.setJavaIOFileDescriptorAccess(
                new sun.misc.JavaIOFileDescriptorAccess() {
                    public void set(FileDescriptor obj, int fd) {
                        obj.fd = fd;
                    }
    
                    public int get(FileDescriptor obj) {
                        return obj.fd;
                    }
    
                    public void setHandle(FileDescriptor obj, long handle) {
                        obj.handle = handle;
                    }
    
                    public long getHandle(FileDescriptor obj) {
                        return obj.handle;
                    }
                }
            );
        }
    

    This means that any code that can access SharedSecrets (I.E. the JRE itself) can also create its own valid FileDescriptor, and should therefore be allowed to access FileDescriptor(). However, there is no way to restrict the access of a constructor to only JRE classes, so it is public.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The Java doc describe that the constructor Date(long date) constructs a Date object using
The javadoc for the java.util.concurrent.atomic package says the following: A small toolkit of classes
I was reading the JavaDoc for Threadlocal here https://docs.oracle.com/javase/1.5.0/docs/api/java/lang/ThreadLocal.html and it says ThreadLocal instances
There is JavaDoc of a normal Java API with an English edition and a
java.lang.String JavaDoc says nothing about the default indexOf(String) substring search algorithm. So my question
from the javadoc for java.lang.Process : The methods that create processes may not work
Destroying threads is deprecated in Java (and not implemented according to javadoc), and interrupting
In Java there's the method Runtime.getRuntime().availableProcessors() which has the following Javadoc: Returns the number
The javadoc says to load the my.sql.Driver class, the META-INF/services/java.sql.Driver file would contain the
I have commented my java source code with javadoc using tags like {@see myPackage.MyClass}.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.