switch(op.getValue()) {
case OPEN:
{
final int b = bufferSize.getValue(conf);
final DFSClient dfsclient = new DFSClient(nnRpcAddr, conf);
DFSDataInputStream in = null;
try {
in = new DFSClient.DFSDataInputStream(
dfsclient.open(fullpath, b, true, null));
in.seek(offset.getValue());
} catch(IOException ioe) {
IOUtils.cleanup(LOG, in);
IOUtils.cleanup(LOG, dfsclient);
throw ioe;
}
final DFSDataInputStream dis = in;
final StreamingOutput streaming = new StreamingOutput() {
@Override
public void write(final OutputStream out) throws IOException {
final Long n = length.getValue();
DFSDataInputStream dfsin = dis;
DFSClient client = dfsclient;
try {
if (n == null) {
IOUtils.copyBytes(dfsin, out, b);
} else {
IOUtils.copyBytes(dfsin, out, n, b, false);
}
dfsin.close();
dfsin = null;
client.close();
client = null;
} finally {
IOUtils.cleanup(LOG, dfsin);