mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8341666: FileInputStream doesn't support readAllBytes() or readNBytes(int) on pseudo devices
Reviewed-by: alanb
This commit is contained in:
parent
52382e285f
commit
1341b81321
7 changed files with 267 additions and 5 deletions
|
@ -264,3 +264,13 @@ handleGetLength(FD fd)
|
|||
#endif
|
||||
return sb.st_size;
|
||||
}
|
||||
|
||||
jboolean
|
||||
handleIsRegularFile(JNIEnv* env, FD fd)
|
||||
{
|
||||
struct stat fbuf;
|
||||
if (fstat(fd, &fbuf) == -1)
|
||||
JNU_ThrowIOExceptionWithLastError(env, "fstat failed");
|
||||
|
||||
return S_ISREG(fbuf.st_mode) ? JNI_TRUE : JNI_FALSE;
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ jint handleAvailable(FD fd, jlong *pbytes);
|
|||
jint handleSetLength(FD fd, jlong length);
|
||||
jlong handleGetLength(FD fd);
|
||||
FD handleOpen(const char *path, int oflag, int mode);
|
||||
jboolean handleIsRegularFile(JNIEnv* env, FD fd);
|
||||
|
||||
/*
|
||||
* Functions to get fd from the java.io.FileDescriptor field
|
||||
|
@ -66,6 +67,7 @@ FD getFD(JNIEnv *env, jobject cur, jfieldID fid);
|
|||
#define IO_Available handleAvailable
|
||||
#define IO_SetLength handleSetLength
|
||||
#define IO_GetLength handleGetLength
|
||||
#define IO_IsRegularFile handleIsRegularFile
|
||||
|
||||
/*
|
||||
* On Solaris, the handle field is unused
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue