String testString = "blah";
FileOutputStream stream = new FileOutputStream(tmpFile);
stream.write(testString.getBytes());
stream.close();
assertTrue(mTestDevice.syncFiles(tmpDir, externalStorePath));
String tmpFileContents = mTestDevice.executeShellCommand(String.format("cat %s",
expectedDeviceFilePath));
assertTrue(tmpFileContents.contains(testString));
tmpDir是哪儿来的?没看到声明呢?
上面是把一个字符串写入一个文件中,后面是将一个文件中的内容赋值给一个字符串,然后判断该文件内容是否包含“blah”
assertTrue作为一个断言
http://www.cnblogs.com/yuyijq/archive/2011/09/03/2165347.html
哈哈哈哈哈怕怕怕怕怕怕怕怕怕怕怕怕怕怕怕怕怕
String testString = "blah";
FileOutputStream stream = new FileOutputStream(tmpFile);
stream.write(testString.getBytes());
stream.close();
这一段的意思是: 新建一个与临时文件 temFile 有关的文件输出流 stream 用于读取相关内容
调用 write() 方法以 字节形式 写入 stream 流,(即将字符串 textString 的内容保存至文件流中)
关闭流,(流不关闭,会引起异常)
对了如果对流没概念,先看看书