Java Code Examples for org.apache.hadoop.fs.HasFileDescriptor

The following examples show how to use org.apache.hadoop.fs.HasFileDescriptor. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: hadoop   Source File: IFileInputStream.java    License: Apache License 2.0 5 votes vote down vote up
private static FileDescriptor getFileDescriptorIfAvail(InputStream in) {
  FileDescriptor fd = null;
  try {
    if (in instanceof HasFileDescriptor) {
      fd = ((HasFileDescriptor)in).getFileDescriptor();
    } else if (in instanceof FileInputStream) {
      fd = ((FileInputStream)in).getFD();
    }
  } catch (IOException e) {
    LOG.info("Unable to determine FileDescriptor", e);
  }
  return fd;
}
 
Example 2
Source Project: hadoop   Source File: CryptoInputStream.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public FileDescriptor getFileDescriptor() throws IOException {
  if (in instanceof HasFileDescriptor) {
    return ((HasFileDescriptor) in).getFileDescriptor();
  } else if (in instanceof FileInputStream) {
    return ((FileInputStream) in).getFD();
  } else {
    return null;
  }
}
 
Example 3
Source Project: big-c   Source File: IFileInputStream.java    License: Apache License 2.0 5 votes vote down vote up
private static FileDescriptor getFileDescriptorIfAvail(InputStream in) {
  FileDescriptor fd = null;
  try {
    if (in instanceof HasFileDescriptor) {
      fd = ((HasFileDescriptor)in).getFileDescriptor();
    } else if (in instanceof FileInputStream) {
      fd = ((FileInputStream)in).getFD();
    }
  } catch (IOException e) {
    LOG.info("Unable to determine FileDescriptor", e);
  }
  return fd;
}
 
Example 4
Source Project: big-c   Source File: CryptoInputStream.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public FileDescriptor getFileDescriptor() throws IOException {
  if (in instanceof HasFileDescriptor) {
    return ((HasFileDescriptor) in).getFileDescriptor();
  } else if (in instanceof FileInputStream) {
    return ((FileInputStream) in).getFD();
  } else {
    return null;
  }
}
 
Example 5
Source Project: incubator-tez   Source File: IFileInputStream.java    License: Apache License 2.0 5 votes vote down vote up
private static FileDescriptor getFileDescriptorIfAvail(InputStream in) {
  FileDescriptor fd = null;
  try {
    if (in instanceof HasFileDescriptor) {
      fd = ((HasFileDescriptor)in).getFileDescriptor();
    } else if (in instanceof FileInputStream) {
      fd = ((FileInputStream)in).getFD();
    }
  } catch (IOException e) {
    LOG.info("Unable to determine FileDescriptor", e);
  }
  return fd;
}
 
Example 6
Source Project: tez   Source File: IFileInputStream.java    License: Apache License 2.0 5 votes vote down vote up
private static FileDescriptor getFileDescriptorIfAvail(InputStream in) {
  FileDescriptor fd = null;
  try {
    if (in instanceof HasFileDescriptor) {
      fd = ((HasFileDescriptor)in).getFileDescriptor();
    } else if (in instanceof FileInputStream) {
      fd = ((FileInputStream)in).getFD();
    }
  } catch (IOException e) {
    LOG.info("Unable to determine FileDescriptor", e);
  }
  return fd;
}