功能：将结果文件内容 转换成明文字符串：解base64,解压缩<br>
适用到的交易：批量交易状态查询<br>
@param fileContent 批量交易状态查询返回的文件内容<br>
@return 内容明文<br>
359396
public static String getFileContent(String fileContent,String encoding){
		String fc = "";
		try {
			fc = new String(SDKUtil.inflater(SecureUtil.base64Decode(fileContent.getBytes())),encoding);
		} catch (UnsupportedEncodingException e) {
			LogUtil.writeErrorLog(e.getMessage(), e);
		} catch (IOException e) {
			LogUtil.writeErrorLog(e.getMessage(), e);
		}
		return fc;
	}
202584
public String getContent() {

        if ((m_content.length() == 0) && (getFile() != null)) {
            m_content = new String(getFile().getContents());
        }
        return m_content;
    }
1222396
public static function getMediaTypeFromFileContent(string $fileContent): string
    {
        $fileInfo = new \finfo(FILEINFO_MIME);
        $mediaType = self::trimMediaType($fileInfo->buffer($fileContent));
        return isset(self::$mediaTypeToFileExtension[$mediaType]) ? $mediaType : 'application/octet-stream';
    }
809859
@SuppressWarnings("static-method")
	protected String buildContent(String description, Charset charset) throws IOException {
		final StringBuilder fullContent = new StringBuilder();

		// User message
		if (!Strings.isEmpty(description)) {
			fullContent.append(description);
			fullContent.append(Messages.SubmitEclipseLogWizard_8);
		}

		// Log
		final SARLEclipsePlugin plugin = SARLEclipsePlugin.getDefault();
		plugin.getLog().log(plugin.createStatus(IStatus.INFO, Messages.SubmitEclipseLogWizard_12));

		fullContent.append(Messages.SubmitEclipseLogWizard_9);
		final String filename = Platform.getLogFileLocation().toOSString();
		final File log = new File(filename);
		if (!log.exists()) {
			throw new IOException("Unable to find the log file"); //$NON-NLS-1$
		}
		final List<String> logLines = Files.readLines(log, charset);
		int logStartIndex = -1;
		for (int i = logLines.size() - 1; logStartIndex == -1 && i >= 0; --i) {
			final String line = logLines.get(i);
			if (line.startsWith("!SESSION")) { //$NON-NLS-1$
				logStartIndex = i;
			}
		}
		for (int i = logStartIndex; i < logLines.size(); ++i) {
			fullContent.append(logLines.get(i));
			fullContent.append(Messages.SubmitEclipseLogWizard_8);
		}

		// Properties
		fullContent.append(Messages.SubmitEclipseLogWizard_10);
		for (final Entry<Object, Object> entry : System.getProperties().entrySet()) {
			fullContent.append(Objects.toString(entry.getKey()));
			fullContent.append(Messages.SubmitEclipseLogWizard_11);
			fullContent.append(Objects.toString(entry.getValue()));
			fullContent.append(Messages.SubmitEclipseLogWizard_8);
		}
		fullContent.append(Messages.SubmitEclipseLogWizard_13);

		return fullContent.toString();
	}
177474
public static String encodeFromFile(final String filename) {

        java.io.File file = new java.io.File(filename);
        long fileLength = file.length();

        java.io.InputStream ins;
        try {
            ins = new java.io.FileInputStream(file);
        } catch (FileNotFoundException e) {
            System.out.println("Error opening file " + filename + e.getMessage());
            return null;
        }
        String encodedData = encodeFromInputStream(ins, fileLength);
        if (encodedData == null) {
            System.err.println("Error encoding from file " + filename);
        }
        return encodedData;
    }
1189482
public static String encodeBase64(String content, TestContext context) {
        return new EncodeBase64Function().execute(Collections.singletonList(content), context);
    }
47606
public String getContentAsString() {
		if (contentAsString == null) {
			contentAsString = new String(rawContent,
					UriComponentEncoder.UTF8_CHARSET);
		}
		return contentAsString;
	}
1022951
function encodeToBase64(editor, imgPath, pos) {
		var editorFile = editor.getFilePath();
		var defaultMimeType = 'application/octet-stream';

		if (editorFile === null) {
			throw "You should save your file before using this action";
		}

		// locate real image path
		file.locateFile(editorFile, imgPath, function(realImgPath) {
			if (realImgPath === null) {
				throw "Can't find " + imgPath + ' file';
			}

			file.read(realImgPath, function(err, content) {
				if (err) {
					throw 'Unable to read ' + realImgPath + ': ' + err;
				}

				var b64 = base64.encode(String(content));
				if (!b64) {
					throw "Can't encode file content to base64";
				}

				b64 = 'data:' + (actionUtils.mimeTypes[String(file.getExt(realImgPath))] || defaultMimeType) +
					';base64,' + b64;

				editor.replaceContent('$0' + b64, pos, pos + imgPath.length);
			});
		});

		return true;
	}
1215634
public BoxFile.Info uploadFile(InputStream fileContent, String name) {
        FileUploadParams uploadInfo = new FileUploadParams()
                .setContent(fileContent)
                .setName(name);
        return this.uploadFile(uploadInfo);
    }
624568
public String guessContentTypeFromFile(File file) {
        String contentType = URLConnection.guessContentTypeFromName(file.getName());
        if (contentType == null) {
            return "application/octet-stream";
        } else {
            return contentType;
        }
    }
666444
protected File getContentSrcAsFile(IRI contentSrc, File tempDir) throws ObjectIntegrityException, IOException {
        if (contentSrc.isAbsolute() || contentSrc.isPathAbsolute()) {
            throw new ObjectIntegrityException("contentSrc must not be absolute");
        }
        try {
            // Normalize the IRI to resolve percent-encoding and
            // backtracking (e.g. "../")
            NormalizedURI nUri = new NormalizedURI(tempDir.toURI().toString() + contentSrc.toString());
            nUri.normalize();

            File f = new File(nUri.toURI());
            if (f.getParentFile().equals(tempDir)) {
                File temp = File.createTempFile("binary-datastream", null);
                FileUtils.move(f, temp);
                temp.deleteOnExit();
                return temp;
                //return f;
            } else {
                throw new ObjectIntegrityException(contentSrc.toString()
                                                   + " is not a valid path.");
            }
        } catch (URISyntaxException e) {
            throw new ObjectIntegrityException(e.getMessage(), e);
        }
    }
911023
private synchronized void saveFile(String fileContent, File fileName) {
        try {
            if (imports.getSymbols().contains(fileName.getName())) {
                logInfo("   imported " + fileName);
                ++imported;
            } else {
                export.getSymbols().add(fileName.getName());
                MessageDigest algo = MessageDigest.getInstance("MD5");
                algo.update(fileContent.getBytes());
                String md5 = bytesToHexString(algo.digest());
                newHashes.put(fileName.getName(), md5);

                if (!context.getSettings().isUseHash() || !oldFiles.contains(fileName) || !md5.equals(oldHashes.getProperty(fileName.getName()))) {
                    fileName.setWritable(true);
                    BufferedOutputStream writer = new BufferedOutputStream(new FileOutputStream(fileName));
                    writer.write(fileContent.getBytes());
                    fileName.setWritable(false);
                    writer.close();
                    ++generated;
                    logInfo("   generated " + fileName);
                } else {
                    ++skipped;
                    logInfo("   skipped " + fileName);
                }
                oldFiles.remove(fileName);
            }
        } catch (Exception e) {
            throw new RuntimeException("Failed to save file " + e.getMessage());
        }
    }
804578
static String base64(byte[] data) {
        ByteBuf encodedData = Unpooled.wrappedBuffer(data);
        ByteBuf encoded = Base64.encode(encodedData);
        String encodedString = encoded.toString(CharsetUtil.UTF_8);
        encoded.release();
        return encodedString;
    }
1292075
protected String getEncoding(String content) {

        String encoding = content;
        int index = encoding.toLowerCase().indexOf("encoding=\"");
        // encoding attribute found, get the value
        if (index != -1) {
            encoding = encoding.substring(index + 10);
            index = encoding.indexOf("\"");
            if (index != -1) {
                encoding = encoding.substring(0, index);
                return encoding.toUpperCase();
            }
        }
        // no encoding attribute found
        return "";
    }
1112471
function readFileContent(fileName){
    try{
        return(fs.readFileSync(fileName , "utf-8"));
    }catch(e){
        console.log("---readFileContent-- Error reading file "+fileName);
        console.log(e);
        return null;
    }
}
1240494
public static String readFileContent(String filename) throws FileNotFoundException, IOException {
        BufferedReader reader = new BufferedReader(new FileReader(filename));
        StringBuilder content = new StringBuilder();
        String line;
        final String eol = System.getProperty("line.separator");
        while ((line = reader.readLine()) != null) {
            content.append(line);
            content.append(eol);
        }
        reader.close();
        return content.toString();
    }
1101335
public static String getImgStr(String imgFile) {
        //将图片文件转化为字节数组字符串，并对其进行Base64编码处理

        InputStream in;
        byte[] data = null;
        //读取图片字节数组
        try {
            in = new FileInputStream(imgFile);
            data = new byte[in.available()];
            in.read(data);
            in.close();

        } catch (IOException e) {
            e.printStackTrace();

        }
        return new String(Base64.encodeBase64(data));

    }