首页天道酬勤object转string,int转为string

object转string,int转为string

张世龙 05-05 13:31 12次浏览
1.InputStream到String /* *InputStream的字符串*/publicstringinputstrtostr (inputstream inputstream ) throwsioexception { byttrem //将文件内容读取到字节数组int offset=0中int numRead=0; while (offset bytes.length (numread=inputstream.read ) bytes,offset,bytes.length - offset ) )0) offset=nuf stream } inputStream.close (; stringencodedfilestring=base64.get encoder ().encodetostring(bytes ); 返回编码文件字符串; }2.从string转换为InputStream /* *字符串inputstream */publicinputstreamstr2inputstr (string instr (try ) byte ) bytes=base66s }catch(exceptione ) {e.printStackTrace ); }返回空值; }
python字符串转float类型,将list转为list