-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add java.io.FileDescriptor
#124
base: 4.7
Are you sure you want to change the base?
Add java.io.FileDescriptor
#124
Conversation
Down the line this will allow FileOutputStream.this(FileDescriptor) to work for STDIN, STDOUT, and STDERR System.out and co. outline: https://stackoverflow.com/a/14435324
'const' from fFD and fHandle were removed to allow 'setting' in the future.
Was used when in_, out_, and err were immutable but isn't required now.
Is this ported from the Java source code or is a reimplementation? |
package int getFD() | ||
{ | ||
return fFD; | ||
} | ||
|
||
/// Windows file HANDLE | ||
package void* getHandle() | ||
{ | ||
return fHandle; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these be const
as well? Otherwise they cannot be on the constants below.
version (Posix) { | ||
return fFD >= 0; | ||
} else version (Windows) { | ||
return (fFD >= 0) && (fHandle !is null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is fFD
ever used on Windows?
* Usually, this file descriptor is not used directly, but rather via the | ||
* output stream known as `System.in`. | ||
*/ | ||
public static const FileDescriptor in_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if there are other static variables which are objects in the code base, but these are thread local storage, do we want that?
I want to get System.{in,out,err} to allow the SWTException and SWTError tests to be fully implemented. In particular, this would allow the
.printStackTrace
to useSystem.err_
. I think it would also just be fun to have the streams working in general 😄By default, each of the PrintStreams are File{Input,Output}Stream which use a FileDescriptor (ref).