@Test public void copyToLocalLargeTest() throws IOException { TestUtils.createByteFile(mTfs, "/testFile", WriteType.MUST_CACHE, mSizeBytes); mFsShell.copyToLocal(new String[] { "copyToLocal", "/testFile", mLocalTachyonCluster.getTachyonHome() + "/testFile" }); Assert.assertEquals(getCommandOutput(new String[] { "copyToLocal", "/testFile", mLocalTachyonCluster.getTachyonHome() + "/testFile" }), mOutput.toString()); File testFile = new File(mLocalTachyonCluster.getTachyonHome() + "/testFile"); FileInputStream fis = new FileInputStream(testFile); byte read[] = new byte[mSizeBytes]; fis.read(read); fis.close(); Assert.assertTrue(TestUtils.equalIncreasingByteArray(mSizeBytes, read)); }
public int copyToLocal(String argv[]) throws IOException { if (argv.length != 3) { System.out.println("Usage: tfs copyToLocal <src> <localdst>"); return -1; } String srcPath = argv[1]; String dstPath = argv[2]; String folder = Utils.getFilePath(srcPath); File dst = new File(dstPath); TachyonFS tachyonClient = TachyonFS.get(Utils.validatePath(srcPath)); TachyonFile tFile = tachyonClient.getFile(folder); if (tFile == null) { throw new IOException(folder); } InStream is = tFile.getInStream(ReadType.NO_CACHE); FileOutputStream out = new FileOutputStream(dst); byte[] buf = new byte[512]; int t = is.read(buf); while (t != -1) { out.write(buf, 0, t); t = is.read(buf); } out.close(); System.out.println("Copied " + srcPath + " to " + dstPath); return 0; }
TFsShell { public int copyToLocal(String argv[]) throws IOException { if (argv.length != 3) { System.out.println("Usage: tfs copyToLocal <src> <localdst>"); return -1; } String srcPath = argv[1]; String dstPath = argv[2]; String folder = Utils.getFilePath(srcPath); File dst = new File(dstPath); TachyonFS tachyonClient = TachyonFS.get(Utils.validatePath(srcPath)); TachyonFile tFile = tachyonClient.getFile(folder); if (tFile == null) { throw new IOException(folder); } InStream is = tFile.getInStream(ReadType.NO_CACHE); FileOutputStream out = new FileOutputStream(dst); byte[] buf = new byte[512]; int t = is.read(buf); while (t != -1) { out.write(buf, 0, t); t = is.read(buf); } out.close(); System.out.println("Copied " + srcPath + " to " + dstPath); return 0; } }
TFsShell { public int copyToLocal(String argv[]) throws IOException { if (argv.length != 3) { System.out.println("Usage: tfs copyToLocal <src> <localdst>"); return -1; } String srcPath = argv[1]; String dstPath = argv[2]; String folder = Utils.getFilePath(srcPath); File dst = new File(dstPath); TachyonFS tachyonClient = TachyonFS.get(Utils.validatePath(srcPath)); TachyonFile tFile = tachyonClient.getFile(folder); if (tFile == null) { throw new IOException(folder); } InStream is = tFile.getInStream(ReadType.NO_CACHE); FileOutputStream out = new FileOutputStream(dst); byte[] buf = new byte[512]; int t = is.read(buf); while (t != -1) { out.write(buf, 0, t); t = is.read(buf); } out.close(); System.out.println("Copied " + srcPath + " to " + dstPath); return 0; }  }
TFsShell { public int copyToLocal(String argv[]) throws IOException { if (argv.length != 3) { System.out.println("Usage: tfs copyToLocal <src> <localdst>"); return -1; } String srcPath = argv[1]; String dstPath = argv[2]; String folder = Utils.getFilePath(srcPath); File dst = new File(dstPath); TachyonFS tachyonClient = TachyonFS.get(Utils.validatePath(srcPath)); TachyonFile tFile = tachyonClient.getFile(folder); if (tFile == null) { throw new IOException(folder); } InStream is = tFile.getInStream(ReadType.NO_CACHE); FileOutputStream out = new FileOutputStream(dst); byte[] buf = new byte[512]; int t = is.read(buf); while (t != -1) { out.write(buf, 0, t); t = is.read(buf); } out.close(); System.out.println("Copied " + srcPath + " to " + dstPath); return 0; }  static void main(String argv[]); int cat(String argv[]); int copyFromLocal(String argv[]); int copyToLocal(String argv[]); int count(String argv[]); int fileinfo(String argv[]); int location(String argv[]); int ls(String argv[]); int lsr(String argv[]); int mkdir(String argv[]); int pin(String argv[]); int unpin(String argv[]); void printUsage(); int rename(String argv[]); int report(String argv[]); int request(String argv[]); int rm(String argv[]); int run(String argv[]); int tail(String argv[]); int touch(String argv[]); }
TFsShell { public int copyToLocal(String argv[]) throws IOException { if (argv.length != 3) { System.out.println("Usage: tfs copyToLocal <src> <localdst>"); return -1; } String srcPath = argv[1]; String dstPath = argv[2]; String folder = Utils.getFilePath(srcPath); File dst = new File(dstPath); TachyonFS tachyonClient = TachyonFS.get(Utils.validatePath(srcPath)); TachyonFile tFile = tachyonClient.getFile(folder); if (tFile == null) { throw new IOException(folder); } InStream is = tFile.getInStream(ReadType.NO_CACHE); FileOutputStream out = new FileOutputStream(dst); byte[] buf = new byte[512]; int t = is.read(buf); while (t != -1) { out.write(buf, 0, t); t = is.read(buf); } out.close(); System.out.println("Copied " + srcPath + " to " + dstPath); return 0; }  static void main(String argv[]); int cat(String argv[]); int copyFromLocal(String argv[]); int copyToLocal(String argv[]); int count(String argv[]); int fileinfo(String argv[]); int location(String argv[]); int ls(String argv[]); int lsr(String argv[]); int mkdir(String argv[]); int pin(String argv[]); int unpin(String argv[]); void printUsage(); int rename(String argv[]); int report(String argv[]); int request(String argv[]); int rm(String argv[]); int run(String argv[]); int tail(String argv[]); int touch(String argv[]);  }