boolean canRead = true;
boolean canWrite = true;
if (element instanceof RemoteFile) {
RemoteFile file = (RemoteFile)element;
canRead = file.canRead();
canWrite = file.canWrite();
}
else if (element instanceof File) {
File file = (File)element;
canRead = file.canRead();
canWrite = file.canWrite();