_TestHelperpublic class _TestHelper extends Object This class provides access to package-level features defined in the
store package. It is used for testing only. |
Methods Summary |
---|
public static boolean | isFSInputStream(InputStream is)Returns true if the instance of the provided input stream is actually
an FSInputStream.
return is instanceof FSInputStream;
| public static boolean | isFSInputStreamClone(InputStream is)Returns true if the provided input stream is an FSInputStream and
is a clone, that is it does not own its underlying file descriptor.
if (isFSInputStream(is)) {
return ((FSInputStream) is).isClone;
} else {
return false;
}
| public static boolean | isFSInputStreamOpen(InputStream is)Given an instance of FSDirectory.FSInputStream, this method returns
true if the underlying file descriptor is valid, and false otherwise.
This can be used to determine if the OS file has been closed.
The descriptor becomes invalid when the non-clone instance of the
FSInputStream that owns this descriptor is closed. However, the
descriptor may possibly become invalid in other ways as well.
if (isFSInputStream(is)) {
FSInputStream fis = (FSInputStream) is;
return fis.isFDValid();
} else {
return false;
}
|
|