当前位置: 首页>>代码示例>>Java>>正文


Java Charsets.UTF_8属性代码示例

本文整理汇总了Java中com.google.api.client.util.Charsets.UTF_8属性的典型用法代码示例。如果您正苦于以下问题:Java Charsets.UTF_8属性的具体用法?Java Charsets.UTF_8怎么用?Java Charsets.UTF_8使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.google.api.client.util.Charsets的用法示例。


在下文中一共展示了Charsets.UTF_8属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onDisable

@Override
public void onDisable() {
	try {
		logCat.close();
		String dat = new String(Serializer.<Map<String, UUID>>serializeBase64(uuid_map), Charsets.UTF_8);
		if(uuidFile.exists()) {
			BufferedWriter bw = new BufferedWriter(new FileWriter(uuidFile));
			bw.write(dat);
			bw.flush();
			bw.close();
		} else {
			
		}
	} catch (Exception | Error e) {
		getLogger().log(Level.SEVERE, e.getMessage(), e);
	}
}
 
开发者ID:ramidzkh,项目名称:Bssentials-Reloaded,代码行数:17,代码来源:Bssentials.java

示例2: fromStreamToString

/**
 * Reads an input stream line by line and converts it into String.
 * @param inputStream
 * @throws IOException
 */
public static String fromStreamToString(InputStream inputStream)
        throws IOException {
    BufferedReader bufferedReader = null;
    StringBuilder stringBuilder = new StringBuilder();
    try {
        String line;
        bufferedReader = new BufferedReader(new InputStreamReader(inputStream, Charsets.UTF_8));
        while ((line = bufferedReader.readLine()) != null) {
            stringBuilder.append(line);
        }
    } finally {
        if (bufferedReader != null) {
            bufferedReader.close();
        }
    }
    return stringBuilder.toString();
}
 
开发者ID:The-WebOps-Club,项目名称:saarang-iosched,代码行数:22,代码来源:UserDataHelper.java

示例3: fromStreamToString

/**
 * Reads an input stream line by line and converts it into String.
 * @param inputStream
 * @throws java.io.IOException
 */
public static String fromStreamToString(InputStream inputStream)
        throws IOException {
    BufferedReader bufferedReader = null;
    StringBuilder stringBuilder = new StringBuilder();
    try {
        String line;
        bufferedReader = new BufferedReader(new InputStreamReader(inputStream, Charsets.UTF_8));
        while ((line = bufferedReader.readLine()) != null) {
            stringBuilder.append(line);
        }
    } finally {
        if (bufferedReader != null) {
            bufferedReader.close();
        }
    }
    return stringBuilder.toString();
}
 
开发者ID:ramonrabello,项目名称:devfestnorte-app,代码行数:22,代码来源:UserDataHelper.java

示例4: onCreate

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mLogArea = new TextView(this);

    ApiClientAsyncTask<Void, Void, String> task = new ApiClientAsyncTask<Void, Void, String>(this) {
        @Override
        protected String doInBackgroundConnected(Void[] params) {
            StringBuffer result = new StringBuffer();
            MetadataBuffer buffer = Drive.DriveApi.getAppFolder(getGoogleApiClient())
                    .listChildren(getGoogleApiClient()).await().getMetadataBuffer();

            result.append("found " + buffer.getCount() + " files:\n");
            for (Metadata m: buffer) {
                DriveId id = m.getDriveId();
                DriveFile file = Drive.DriveApi.getFile(getGoogleApiClient(), id);

                Contents contents = file.openContents( getGoogleApiClient(),
                        DriveFile.MODE_READ_ONLY, null).await().getContents();

                FileInputStream is = new FileInputStream(contents.getParcelFileDescriptor().getFileDescriptor());
                try {
                    BufferedReader bf = new BufferedReader(new InputStreamReader(is, Charsets.UTF_8));
                    String line=null; StringBuffer sb=new StringBuffer();
                    while ((line=bf.readLine()) != null ) {
                        sb.append(line);
                    }
                    file.discardContents(getGoogleApiClient(), contents);
                    result.append("*** " + m.getTitle() + "/" + id + "/" + m.getFileSize() + "B:\n   [" + sb.toString() + "]\n");
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            buffer.close();
            return result.toString();
        }

        @Override
        protected void onPostExecute(String s) {
            if (mLogArea != null) {
                mLogArea.append(s);
            }
        }
    };
    task.execute();

}
 
开发者ID:The-WebOps-Club,项目名称:saarang-iosched,代码行数:47,代码来源:ViewFilesInAppFolderActivity.java


注:本文中的com.google.api.client.util.Charsets.UTF_8属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。