| | |
| | | return getAPPInternalStoreFilesPath() + "/upgrade/firmware"; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取【日志文件】全路径 |
| | | */ |
| | |
| | | /** |
| | | * 获取固件升级文件全路径 |
| | | * |
| | | * @param oid 该固件oid |
| | | * @param imageId 镜像id |
| | | * @param version 驱动版本 |
| | | * @return 全路径 |
| | | */ |
| | | public String getFirmwarePathFileName(String oid, String imageId, String version) { |
| | | String fileName = oid + "_" + imageId + "_" + version + ".zip"; |
| | | public String getFirmwarePathFileName(String imageId, String version) { |
| | | String fileName = imageId + "_" + version + ".zip"; |
| | | return HdlFileLogic.getInstance().getFirmwareRootPath() + "/" + fileName; |
| | | } |
| | | |
| | |
| | | d.flush(); |
| | | d.close(); |
| | | if (file.length() > 1024 * 1024 * mDataSize) { |
| | | //文件大于1m,删除文件前10条日志 |
| | | this.delFileLien(fullPath, 10); |
| | | //文件大于1m,删除文件前100条日志 |
| | | this.delFileLien(fullPath, 100); |
| | | } |
| | | System.out.println("写入一行数据到文件成功--->" + dataLine); |
| | | // System.out.println("写入一行数据到文件成功--->" + dataLine); |
| | | } catch (Exception e) { |
| | | System.out.println("写入一行数据到文件有异常--->" + e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 读取文件 |
| | | * |
| | | * @param filePath 全路径 |
| | | * @return 数据 |
| | | */ |
| | | public byte[] readFileByte1(String filePath) { |
| | | try { |
| | | if (!isBoolean(filePath)) { |
| | | return null; |
| | | } |
| | | File f = new File(filePath); |
| | | if (!f.exists()) { |
| | | return null; |
| | | } |
| | | FileInputStream fis = new FileInputStream(f); |
| | | byte[] bytes = FileUtils.readFileToByteArray(f);//这个方法不兼用android 6.0 |
| | | fis.close(); |
| | | System.out.println("读取文件成功--->" + filePath); |
| | | return bytes; |
| | | } catch (Exception e1) { |
| | | System.out.println("读取文件有异常--->" + e1.getMessage()); |
| | | return null; |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 读取文件 |
| | |
| | | return null; |
| | | } |
| | | FileInputStream fis = new FileInputStream(f); |
| | | byte[] bytes = FileUtils.readFileToByteArray(f); |
| | | BufferedInputStream bis = new BufferedInputStream(fis); |
| | | int fileLength = (int) f.length(); |
| | | byte[] bytes = new byte[fileLength]; |
| | | int len = bis.read(bytes); |
| | | bis.close(); |
| | | fis.close(); |
| | | System.out.println("读取文件成功--->" + filePath); |
| | | return bytes; |