保存在 /sdcard/DCIM/xxx，用于拍照图片保存
501999
public static File createMediaFile(String dirName) {
        String timeStamp = IMG_FILE_NAME_FORMAT.format(new Date());
        String imageFileName = PREFIX_IMAGE + timeStamp + EXTENSION_JPEG;
        return new File(getMediaDir(dirName), imageFileName);
    }
499703
function (sLayer, sNameSpace, sFileName, sFileType, sData, sTransportId, sPackageName) {
			return LRepConnector.saveFile(sLayer, sNameSpace, sFileName, sFileType, sData, sTransportId, sPackageName).then(this._navToDisplayMode.bind(this));
		}
894755
function WriteDeviceData(
      $write_device_data_array = true
  ) {
      if (is_array($write_device_data_array)) {
        if (!isset($write_device_data_array['with_radius_update'])) {
          $write_device_data_array['with_radius_update'] = TRUE;
        }
      } else {
        $temp_array = array();
        $temp_array['with_radius_update'] = $write_device_data_array;
        $write_device_data_array = $temp_array;
      }

      if ('' == trim($this->GetDevice())) {
          $result = false;
      } else {
          $result = $this->WriteData(array_merge(array('item'               => 'Device',
                                                       'table'              => 'devices',
                                                       'folder'             => $this->GetDevicesFolder(),
                                                       'data_array'         => $this->_device_data,
                                                       'force_file'         => false,
                                                       'id_field'           => 'device_id',
                                                       'id_value'           => $this->GetDevice()
                                                      ), $write_device_data_array));
      }
      return $result;
  }
1074263
public static void saveAsFile(byte[] data, String addr) throws IOException {
        log.debug("将字节数据保存到本地文件");
        File file = new File(addr);
        if (!file.exists()) {
            if (!file.getParentFile().mkdirs()) {
                log.error("创建目录{}失败", addr);
            }
        }
        log.debug("保存路径为：{}", file.getAbsolutePath());
        FileOutputStream out = new FileOutputStream(file);
        out.write(data);
        out.flush();
        out.close();
        log.debug("文件保存完毕");
    }
374859
static void saveINode2Image(INode node,
                                      DataOutputStream out) throws IOException {
    byte[] name = node.getLocalNameBytes();
    out.writeShort(name.length);
    out.write(name);
    out.writeLong(node.getId());
    
    if (node instanceof INodeHardLinkFile) {
      // Process the hard link file:  
      // If the hard link has more than 1 reference cnt, then store its type with the hard link ID  
      // Otherwise, just store the regular INodeFile's inode type.  
      INodeHardLinkFile hardLink = (INodeHardLinkFile)node; 
      if (hardLink.getHardLinkFileInfo().getReferenceCnt() > 1) {
        out.writeByte(INode.INodeType.HARDLINKED_INODE.type); 
        WritableUtils.writeVLong(out, ((INodeHardLinkFile)node).getHardLinkID()); 
      } else {
        throw new IOException("Invalid reference count for the hardlink file: " +
            node.getFullPathName() + " with the hardlink ID: " + hardLink.getHardLinkID() +
            " and reference cnt: " + hardLink.getHardLinkFileInfo().getReferenceCnt());
      }
    } else if (node instanceof INodeFile && 
        ((INodeFile)node).getStorageType() == StorageType.RAID_STORAGE) {
      INodeFile raidFile = (INodeFile)node;
      INodeRaidStorage storage = (INodeRaidStorage)raidFile.getStorage();
      out.writeByte(INode.INodeType.RAIDED_INODE.type);
      WritableUtils.writeString(out, storage.getCodec().id);
    } else {
      // Process the regular files and directory: just store its inode type 
      out.writeByte(INode.INodeType.REGULAR_INODE.type); 
    }

    FsPermission filePerm = TL_DATA.get().FILE_PERM;
    if (!node.isDirectory()) {  // write file/hardlink inode
      INodeFile fileINode = (INodeFile)node;
      out.writeShort(fileINode.getReplication());
      out.writeLong(fileINode.getModificationTime());
      out.writeLong(fileINode.getAccessTime());
      out.writeLong(fileINode.getPreferredBlockSize());
      writeBlocks(fileINode.getBlocks(), out);
      filePerm.fromShort(fileINode.getFsPermissionShort());
      PermissionStatus.write(out, fileINode.getUserName(),
                             fileINode.getGroupName(),
                             filePerm);
    } else {   // write directory inode
      out.writeShort(0);  // replication
      out.writeLong(node.getModificationTime());
      out.writeLong(0);   // access time
      out.writeLong(0);   // preferred block size
      out.writeInt(-1);    // # of blocks
      out.writeLong(node.getNsQuota());
      out.writeLong(node.getDsQuota());
      filePerm.fromShort(node.getFsPermissionShort());
      PermissionStatus.write(out, node.getUserName(),
                             node.getGroupName(),
                             filePerm);
    }
  }
359845
def save_wdhistory(self):
        """"""
        text = [ to_text_string( self.pathedit.itemText(index) ) \
                 for index in range(self.pathedit.count()) ]
        try:
            encoding.writelines(text, self.LOG_PATH)
        except EnvironmentError:
            pass
722260
static boolean saveDat(TreeMap<String, Character> map)
    {
        try
        {
            DataOutputStream out = new DataOutputStream(new BufferedOutputStream(IOUtil.newOutputStream(path + Predefine.VALUE_EXT)));
            out.writeInt(map.size());
            for (Character character : map.values())
            {
                out.writeChar(character);
            }
            out.close();
        }
        catch (Exception e)
        {
            logger.warning("保存值" + path + Predefine.VALUE_EXT + "失败" + e);
            return false;
        }
        return trie.save(path + Predefine.TRIE_EXT);
    }
236341
def save(self):
        """"""
        if self.save_option == 'curdir':
            model_path = os.path.join(
                os.getcwd(),
                '{}.lcopt'.format(self.name)
            )
        else: # default to appdir
            model_path = os.path.join(
                storage.model_dir,
                '{}.lcopt'.format(self.name)
            )
        
        model_path = fix_mac_path_escapes(model_path)

        with open(model_path, 'wb') as model_file:
            pickle.dump(self, model_file)
817725
def savePkeyPem(self, pkey, path):
        '''
        
        '''
        with s_common.genfile(path) as fd:
            fd.write(crypto.dump_privatekey(crypto.FILETYPE_PEM, pkey))
440916
private int save(Object po, String autoGeneratedColumnName) throws Exception {

		SqlParamsPairs sqlAndParams = ModelSqlUtils.getInsertFromObject(po);

		//动态切换库名
		String sql = sqlAndParams.getSql();
		
		return getProxy().insert(sql, sqlAndParams.getParams(), autoGeneratedColumnName);
	}
829632
private File getStorageDir() {
        String externalStorageState = Environment.getExternalStorageState();
        if (!externalStorageState.equals(Environment.MEDIA_MOUNTED)) {
            return null;
        }

        // 默认在外置程序包下面.logs 文件夹
        File file = getExternalStorageDirectory();

        if (fileName.startsWith("/")) {
            File tmp = new File(fileName);
            if (tmp.isDirectory())
                return tmp;

            return new File(file, getFileNameWithoutExtension(fileName));
        }

        String tmp = Environment.getExternalStorageDirectory().getPath();
        if (fileName.startsWith(tmp)) {
            file = new File(file, fileName.replace(tmp, ""));
            return file;
        }

        file = new File(file, "logs");
        file.mkdirs();
        return file;
    }
1341136
private static void initValidateCertFromDir() {
		if(!"01".equals(SDKConfig.getConfig().getSignMethod())){
			LogUtil.writeLog("非rsa签名方式，不加载验签证书。");
			return;
		}
		certMap.clear();
		String dir = SDKConfig.getConfig().getValidateCertDir();
		LogUtil.writeLog("加载验证签名证书目录==>" + dir +" 注：如果请求报文中version=5.1.0那么此验签证书目录使用不到，可以不需要设置（version=5.0.0必须设置）。");
		if (isEmpty(dir)) {
			LogUtil.writeErrorLog("WARN: acpsdk.validateCert.dir is empty");
			return;
		}
		CertificateFactory cf = null;
		FileInputStream in = null;
		try {
			cf = CertificateFactory.getInstance("X.509", "BC");
		}catch (NoSuchProviderException e) {
			LogUtil.writeErrorLog("LoadVerifyCert Error: No BC Provider", e);
			return ;
		} catch (CertificateException e) {
			LogUtil.writeErrorLog("LoadVerifyCert Error", e);
			return ;
		}
		File fileDir = new File(dir);
		File[] files = fileDir.listFiles(new CerFilter());
		for (int i = 0; i < files.length; i++) {
			File file = files[i];
			try {
				in = new FileInputStream(file.getAbsolutePath());
				validateCert = (X509Certificate) cf.generateCertificate(in);
				if(validateCert == null) {
					LogUtil.writeErrorLog("Load verify cert error, " + file.getAbsolutePath() + " has error cert content.");
					continue;
				}
				certMap.put(validateCert.getSerialNumber().toString(),
						validateCert);
				// 打印证书加载信息,供测试阶段调试
				LogUtil.writeLog("[" + file.getAbsolutePath() + "][CertId="
						+ validateCert.getSerialNumber().toString() + "]");
			} catch (CertificateException e) {
				LogUtil.writeErrorLog("LoadVerifyCert Error", e);
			}catch (FileNotFoundException e) {
				LogUtil.writeErrorLog("LoadVerifyCert Error File Not Found", e);
			}finally {
				if (null != in) {
					try {
						in.close();
					} catch (IOException e) {
						LogUtil.writeErrorLog(e.toString());
					}
				}
			}
		}
		LogUtil.writeLog("LoadVerifyCert Finish");
	}
304527
def write(dcm)
      if @write_path
        # The DICOM object is to be written to a separate directory. If the
        # original and the new directories have a common root, this is taken into
        # consideration when determining the object's write path:
        path = destination(dcm)
        if @random_file_name
          file_name = "#{SecureRandom.hex(16)}.dcm"
        else
          file_name = File.basename(dcm.source)
        end
        dcm.write(File.join(path, file_name))
      else
        # The original DICOM file is overwritten with the anonymized DICOM object:
        dcm.write(dcm.source)
      end
    end
435576
function storeFileToDisk(i_oFile, i_sOutput) {
    var l_sDirname = path.dirname(i_oFile.filename),
        l_sFilename;

    console.log("File name: ", i_oFile.filename, " size: ", i_oFile.header.unpackedSize);
    console.log("Saving content of file ");

    l_sDirname = path.join(i_sOutput, path.dirname(i_oFile.filename));
    l_sFilename = path.join(l_sDirname, path.basename(i_oFile.filename));
    return new Promise(function(i_oResolve) {
        mkdirp(l_sDirname, function (err) {
            if (err) console.error(err);
            _writeFile(l_sFilename, i_oFile, i_oResolve);
        });
    });
}
132453
public static void writeToFile(Bitmap bitmap, String dir, String filename) throws FileNotFoundException, IOException {
		File sdCard = Environment.getExternalStorageDirectory();
		File dirFile = new File (sdCard.getAbsolutePath() + "/" + dir);
		dirFile.mkdirs();
		File f = new File(dirFile, filename);
		FileOutputStream fos = new FileOutputStream(f, false);
		bitmap.compress(CompressFormat.PNG, 100 /*ignored for PNG*/, fos);
		fos.flush();
		fos.close();
	}
446831
def save(self):
        
        with NamedTemporaryFile(
            dir=os.path.dirname(self.storage_path), delete=False
        ) as f:
            # we use protocol=2 for python 2/3 compatibility
            dump(self.data, f, protocol=2)
            f.flush()
            os.fsync(f.fileno())
            tmppath = f.name
        os.rename(tmppath, self.storage_path)
651406
def save(self, filename="temp.pkl"):
    
    output = open(filename, 'wb')
    cPickle.dump(self.tm, output, protocol=cPickle.HIGHEST_PROTOCOL)