public boolean blockExists(long blockId) throws IOException { InputStream in = get(blockToKey(blockId), false); if (in == null) { return false; } in.close(); return true; }
@Override public boolean blockExists(long blockId) throws IOException { InputStream in = get(blockToKey(blockId), false); if (in == null) { return false; } in.close(); return true; }
public boolean inodeExists(Path path) throws IOException { InputStream in = get(pathToKey(path), true); if (in == null) { return false; } in.close(); return true; }
public boolean blockExists(long blockId) throws IOException { InputStream in = get(blockToKey(blockId), false); if (in == null) { return false; } in.close(); return true; }
public boolean inodeExists(Path path) throws IOException { InputStream in = get(pathToKey(path), true); if (in == null) { return false; } in.close(); return true; }
@Override public boolean inodeExists(Path path) throws IOException { InputStream in = get(pathToKey(path), true); if (in == null) { return false; } in.close(); return true; }
@Override public INode retrieveINode(Path path) throws IOException { return INode.deserialize(get(pathToKey(path), true)); }
public INode retrieveINode(Path path) throws IOException { return INode.deserialize(get(pathToKey(path), true)); }
public INode retrieveINode(Path path) throws IOException { return INode.deserialize(get(pathToKey(path), true)); }
public File retrieveBlock(Block block, long byteRangeStart) throws IOException { File fileBlock = null; InputStream in = null; OutputStream out = null; try { fileBlock = newBackupFile(); in = get(blockToKey(block), byteRangeStart); out = new BufferedOutputStream(new FileOutputStream(fileBlock)); byte[] buf = new byte[bufferSize]; int numRead; while ((numRead = in.read(buf)) >= 0) { out.write(buf, 0, numRead); } return fileBlock; } catch (IOException e) { // close output stream to file then delete file closeQuietly(out); out = null; // to prevent a second close if (fileBlock != null) { fileBlock.delete(); } throw e; } finally { closeQuietly(out); closeQuietly(in); } }
public File retrieveBlock(Block block, long byteRangeStart) throws IOException { File fileBlock = null; InputStream in = null; OutputStream out = null; try { fileBlock = newBackupFile(); in = get(blockToKey(block), byteRangeStart); out = new BufferedOutputStream(new FileOutputStream(fileBlock)); byte[] buf = new byte[bufferSize]; int numRead; while ((numRead = in.read(buf)) >= 0) { out.write(buf, 0, numRead); } return fileBlock; } catch (IOException e) { // close output stream to file then delete file closeQuietly(out); out = null; // to prevent a second close if (fileBlock != null) { fileBlock.delete(); } throw e; } finally { closeQuietly(out); closeQuietly(in); } }
try { fileBlock = newBackupFile(); in = get(blockToKey(block), byteRangeStart); out = new BufferedOutputStream(new FileOutputStream(fileBlock)); byte[] buf = new byte[bufferSize];