- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有二进制流,我希望它以字节为单位进行转换。之后我想将它下载到 SD 卡中。
我的网络服务:
POST /**********Mobile/**********.asmx HTTP/1.1
Host: ***.***.*.*
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/GetDocument"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetDocument xmlns="http://tempuri.org/">
<DocumentID>string</DocumentID>
</GetDocument>
</soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetDocumentResponse xmlns="http://tempuri.org/">
<GetDocumentResult>string</GetDocumentResult>
</GetDocumentResponse>
</soap:Body>
</soap:Envelope>
我正在尝试的是
SoapObject DocumentRequest = new SoapObject(NAMESPACE, GET_DOCUMENT_METHOD);
DocumentRequest.addProperty("DocumentID", ID);
Log.i("DocumentID", ID);
SoapSerializationEnvelope Envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
Envelope.dotNet = true;
Envelope.setOutputSoapObject(DocumentRequest);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.debug = true;
androidHttpTransport.call(SOAP_ACTION_GETDOCUMENT, Envelope);
SoapPrimitive DocumentResponse = (SoapPrimitive)Envelope.getResponse();
Log.i("DocumentResponse", DocumentResponse.toString());
String DocAsString = DocumentResponse.toString();
byte[] decodedString = DocAsString.getBytes();
Bitmap decodedByte = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length);
ImageView DisplayDoc= (ImageView)findViewById(R.id.displayimage);
DisplayDoc.setImageBitmap(decodedByte);
}
我正在获取二进制流,因为字符串是正确的,或者我需要使用 base64binary。如果是这样,请告诉我下载 image/.pdf/word 文档的正确方法。我已经完成了差异搜索,但没有用。谢谢
编辑:
SoapPrimitive DocumentResponse = (SoapPrimitive)Envelope.getResponse();
Log.i("DocumentResponse", DocumentResponse.toString());
String DocAsString = DocumentResponse.toString();
byte[] decodedString = Base64.decode(DocAsString, Base64.DEFAULT);
/*Bitmap decodedByte = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length);
ImageView DisplayDoc= (ImageView)findViewById(R.id.displayimage);
DisplayDoc.setImageBitmap(decodedByte);*/
File direct = new File(Environment.getExternalStorageDirectory() + "/Downloads");
if(!direct.exists()) {
direct.mkdir(); }
File photo=new File(Environment.getExternalStorageDirectory() + "/Downloads", ID);
if (photo.exists()) {
photo.delete(); }
try {
FileOutputStream fos=new FileOutputStream(photo.getPath());
fos.write(decodedString);
fos.close();
ContentValues values= new ContentValues();
System.out.println(values);
}
catch (java.io.IOException e)
{
Log.e("PictureDemo", "Exception in photoCallback", e);
}
}
catch(Exception e) {
e.printStackTrace();
Toast.makeText(getApplicationContext(), " Network Exception : " + e
+ "Please check network connectivity.", Toast.LENGTH_LONG).show();
}
}
已编辑,Web 服务响应
03-19 10:58:57.797: D/dalvikvm(789): GC_FOR_ALLOC freed 57K, 4% free 6912K/7171K, paused 53ms
03-19 10:58:57.807: I/dalvikvm-heap(789): Grow heap (frag case) to 7.313MB for 488976-byte allocation
03-19 10:58:57.957: D/dalvikvm(789): GC_CONCURRENT freed 1K, 4% free 7388K/7687K, paused 4ms+14ms
03-19 10:58:58.357: D/gralloc_goldfish(789): Emulator without GPU emulation detected.
03-19 10:58:58.497: W/TextLayoutCache(789): computeValuesWithHarfbuzz -- need to force to single run
03-19 10:59:02.327: D/InputEventConsistencyVerifier(789): KeyEvent: ACTION_UP but key was not down.
03-19 10:59:02.327: D/InputEventConsistencyVerifier(789): in android.widget.EditText@41054cd8
03-19 10:59:02.327: D/InputEventConsistencyVerifier(789): 0: sent at 2335155000000, KeyEvent { action=ACTION_UP, keyCode=KEYCODE_TAB, scanCode=15, metaState=0, flags=0x8, repeatCount=0, eventTime=2335155, downTime=2335119, deviceId=0, source=0x101 }
03-19 10:59:04.488: I/LoginDetail(789): Username jarnail@sassypuma.comPassword admin
03-19 10:59:04.537: D/dalvikvm(789): GC_FOR_ALLOC freed 71K, 3% free 7634K/7815K, paused 40ms
03-19 10:59:04.937: I/myLogin(789): 1
03-19 10:59:05.357: D/dalvikvm(789): GC_CONCURRENT freed 360K, 7% free 7698K/8199K, paused 7ms+23ms
03-19 10:59:05.547: I/AllFolders(789): anyType{TreeData=anyType{ID=13002; FolderName=My Drive; ParentID=0; CreatedBy=1; }; TreeData=anyType{ID=13006; FolderName=Testing1; ParentID=0; CreatedBy=1; }; TreeData=anyType{ID=13007; FolderName=Testing123; ParentID=0; CreatedBy=1; }; }
03-19 10:59:05.547: I/System.out(789): 3
03-19 10:59:06.057: D/dalvikvm(789): GC_CONCURRENT freed 362K, 7% free 7761K/8263K, paused 31ms+7ms
03-19 10:59:06.217: W/TextLayoutCache(789): computeValuesWithHarfbuzz -- need to force to single run
03-19 10:59:06.627: W/IInputConnectionWrapper(789): finishComposingText on inactive InputConnection
03-19 10:59:08.307: I/FolderID(789): 13002
03-19 10:59:08.307: I/User_ID(789): 1
03-19 10:59:08.367: D/dalvikvm(789): GC_FOR_ALLOC freed 16K, 5% free 7874K/8263K, paused 45ms
03-19 10:59:08.377: I/dalvikvm-heap(789): Grow heap (frag case) to 8.036MB for 262160-byte allocation
03-19 10:59:08.417: D/dalvikvm(789): GC_FOR_ALLOC freed 3K, 6% free 8127K/8583K, paused 44ms
03-19 10:59:08.917: I/SubFolders(789): anyType{FileFolderDetails=anyType{ID=13003; Name=Doc file; URL=anyType{}; SubjectType=Folder; }; FileFolderDetails=anyType{ID=13004; Name=My Pics; URL=anyType{}; SubjectType=Folder; }; FileFolderDetails=anyType{ID=13005; Name=Testing; URL=anyType{}; SubjectType=Folder; }; FileFolderDetails=anyType{ID=13075; Name=satnam; URL=anyType{}; SubjectType=Folder; }; FileFolderDetails=anyType{ID=13080; Name=Saini; URL=anyType{}; SubjectType=Folder; }; FileFolderDetails=anyType{ID=13084; Name=Jelly; URL=anyType{}; SubjectType=Folder; }; FileFolderDetails=anyType{ID=13092; Name=pushie; URL=anyType{}; SubjectType=Folder; }; FileFolderDetails=anyType{ID=13096; Name=Jarnail_Testing; URL=anyType{}; SubjectType=Folder; }; FileFolderDetails=anyType{ID=13099; Name=amarjeet; URL=anyType{}; SubjectType=Folder; }; FileFolderDetails=anyType{ID=13101; Name=Kaam; URL=anyType{}; SubjectType=Folder; }; FileFolderDetails=anyType{ID=13103; Name=tajmehal; URL=anyType{}; SubjectType=Folder; }; FileFolderDetails=anyType{ID=13105; Name=TextArea; URL=anyType{}; SubjectType=Folder; }; FileFolderDetails=anyType{ID=13107; Name=TextArea1; URL=anyType{}; SubjectType=Folder; }; FileFolderDetails=anyType{ID=13109; Name=TextArea2; URL=anyType{}; SubjectType=Folder; }; FileFolderDetails=anyType{ID=13115; Name=TextArea3; URL=anyType{}; SubjectType=Folder; }; FileFolderDetails=anyType{ID=13121; Name=TextArea5; URL=anyType{}; SubjectType=Folder; }; FileFolderDetails=anyType{ID=13124; Name=Check Char; URL=anyType{}; SubjectType=Folder; }; FileFolderDetails=anyType{ID=13128; Name=amitestinggggg; URL=anyType{}; SubjectType=Folder; }; FileFolderDetails=anyType{ID=13132; Name=kkk; URL=anyType{}; SubjectType=Folder; }; FileFolderDetails=anyType{ID=13136; Name=hhhhhhhhhhhhhhhhhh; URL=anyType{}; SubjectType=Folder; }; FileFolderDetails=anyType{ID=13140; Name=ravitevffvvgfdcvgbgvf; URL=anyType{}; SubjectType=Folder; }; FileFolderDetails=anyType{ID=13144; Name=DMS3.0_Title_Page; URL=anyType{}; SubjectType=Folder; }; FileFolderDetails=anyType{ID=20; Name=office.jpg; URL=InterLogicsMobile/image/Tulips.jpg; SubjectType=File; }; FileFolderDetails=anyType{ID=21; Name=Capture.PNG; URL=InterLogicsMobile/image/Tulips.jpg; SubjectType=File; }; FileFolderDetails=anyType{ID=22; Name=groups.jpg; URL=InterLogicsMobile/image/Tulips.jpg; SubjectType=File; }; FileFolderDetails=anyType{ID=23; Name=Capture1.PNG; URL=InterLogicsMobile/image/Tulips.jpg; SubjectType=File; }; FileFolderDetails=anyType{ID=99; Name=Content4Work.pdf; URL=InterLogicsMobile/image/Tulips.jpg; SubjectType=File; }; FileFolderDetails=anyType{ID=109; Name=Rohit.docx; URL=InterLogicsMobile/image/Tulips.jpg; SubjectType=File; }; FileFolderDetails=anyType{ID=115; Name=Chrysanthemum.jpg; URL=InterLogicsMobile/image/Tulips.jpg; SubjectType=File; }; FileFolderDetails=anyType{ID=123; Name=DMS_Drag_and_Drop(2).doc; URL=InterLogicsMobile/image/Tulips.jpg; SubjectType=File; }; FileFolderDetails=anyType{ID=124; Name=Tulips.jpg; URL=InterLogicsMobile/image/Tulips.jpg; SubjectType=File; }; FileFolderDetails=anyType{ID=125; Name=Jellyfish.jpg; URL=InterLogicsMobile/image/Tulips.jpg; SubjectType=File; }; FileFolderDetails=anyType{ID=126; Name=Koala.jpg; URL=InterLogicsMobile/image/Tulips.jpg; SubjectType=File; }; FileFolderDetails=anyType{ID=127; Name=Lighthouse.jpg; URL=InterLogicsMobile/image/Tulips.jpg; SubjectType=File; }; FileFolderDetails=anyType{ID=128; Name=Jellyfish.jpg; URL=InterLogicsMobile/image/Tulips.jpg; SubjectType=File; }; FileFolderDetails=anyType{ID=129; Name=Jellyfish.jpg; URL=InterLogicsMobile/image/Tulips.jpg; SubjectType=File; }; FileFolderDetails=anyType{ID=130; Name=Jellyfish.jpg; URL=InterLogicsMobile/image/Tulips.jpg; SubjectType=File; }; FileFolderDetails=anyType{ID=131; Name=Jellyfish.jpg; URL=http
03-19 10:59:08.917: I/System.out(789): 41
03-19 10:59:09.527: D/dalvikvm(789): GC_CONCURRENT freed 571K, 9% free 8012K/8711K, paused 23ms+26ms
03-19 10:59:12.787: D/dalvikvm(789): GC_FOR_ALLOC freed 11K, 5% free 8352K/8711K, paused 49ms
03-19 10:59:12.857: D/dalvikvm(789): GC_FOR_ALLOC freed 1K, 3% free 8712K/8967K, paused 50ms
03-19 10:59:12.937: D/dalvikvm(789): GC_FOR_ALLOC freed <1K, 4% free 9163K/9479K, paused 48ms
03-19 10:59:15.427: I/System.out(789): 13003
03-19 10:59:15.427: I/DocumentID(789): 13003
03-19 10:59:15.837: D/dalvikvm(789): GC_CONCURRENT freed 328K, 5% free 9581K/10055K, paused 23ms+5ms
03-19 10:59:15.867: I/DocumentResponse(789): UEsDBBQABgAIAAAAIQAJJIeCgQEAAI4FAAATAAgCW0NvbnRlbnRfVHlwZXNdLnhtbCCiBAIooAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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htfM+ifjUXQ795bQSjKbaw277FYBrlGEsSeLtQ1CB6ndj53OuLkL3YX79WunLeciPbRz4yY2CieArDQxRG9IMEVXQbVJwNxbXWV6HQsYdUjTvLCo6yeRaoswY0ekIEGqXYwq5ZeLUeX6dM6aaYhMIUtznMHuHltFzDXm7cT/KohAqCRHcUKYL5vHWV+Xezfo0MMzogIJUqJUloJJnJL0TCma4/C4C7sHvpRy5Y43HytUhaYgDKcVgTn06u+F/IKTVdXKzV6IbLcTtNHNuRfVsU5fa40OJr7/XlbnnLSz1H9fK643r6v7P8feM
最佳答案
try {
ht.call(SOAP_ACTION, envelope);
final SoapPrimitive response = (SoapPrimitive) envelope.getResponse();
String str =DocumentResponse.toString();
byte[] decodedString = Base64.decode(str, Base64.DEFAULT);
File direct = new File(Environment.getExternalStorageDirectory() + "/Foldername");
if(!direct.exists())
{
direct.mkdir();
}
File photo=new File(Environment.getExternalStorageDirectory() + "/Foldername",Filename);
if (photo.exists())
{
photo.delete();
}
try {
FileOutputStream fos=new FileOutputStream(photo.getPath());
fos.write(decodedString);
fos.close();
ContentValues values= new ContentValues();
}
catch (java.io.IOException e)
{
Log.e("PictureDemo", "Exception in photoCallback", e);
}
}
catch (Exception e) {
e.printStackTrace();
}
将您的字符串转换为 Base64 解码。
例子:byte[] decodedString = Base64.decode(str, Base64.DEFAULT);
使用该字节将文件保存在 SDCard 中。
例子:fos.write(decodedString);
关于android - 将二进制流转换为字节?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15470221/
我正在尝试将谷歌地图集成到 Xamarin Android。但是,如标题中所写,收到错误。此错误出现在我的 SetContentView (Resource.Layout.Main); 上,如下所示:
在 Delphi 中如何以非文本模式打开二进制文件?类似于 C 函数 fopen(filename,"rb") 最佳答案 有几个选项。 1。使用文件流 var Stream: TFileStrea
我现在正在处理一个问题,如下所示: 有两个数字 x1 和 x2 并且 x2 > x1。 例如 x1 = 5; x2 = 10; 而且我必须在二进制表示中找到 x1 和 x2 之间的总和。 5 = 10
我有这个“程序集”文件(仅包含 directives ) // declare protected region as somewhere within the stack .equiv prot_s
有没有办法在powershell中确定指定的文件是否包含指定的字节数组(在任何位置)? 就像是: fgrep --binary-files=binary "$data" "$filepath" 当然,
我是一名工程师,而不是软件程序员,所以请原谅我的无知。 我编写了一个 Delphi(7SE) 程序,用于从连接到两个数字温度计的 USB 端口读取“真实”数据类型。 我已经完成了该计划的大部分内容。
我有一些代码,例如: u=(float *)calloc(n, sizeof(float)); for(i=1; i
typedef struct pixel_type { unsigned char r; unsigned char g; unsigned char b;
如何判断二进制数是否为负数? 目前我有下面的代码。它可以很好地转换为二进制文件。转换为十进制时,我需要知道最左边的位是否为 1 以判断它是否为负数,但我似乎无法弄清楚该怎么做。 此外,我如何才能让它返
我有一个带有适当重载的 Vect*float 运算符的 vector 类,我正在尝试创建全局/非成员 float*Vect 运算符,如下所示:(注意这是一个经过大量编辑的示例) class Vect
对于使用 C 编程的项目,我们正在尝试将图像转换为二进制数据,反之亦然。我们在网上找到的所有其他解决方案都是用 C++ 或 Java 编写的。这是我们尝试过的方法: 将图像转换为包含二进制数据的文本文
我需要对列表的元素求和,其中包含所有零或一,如果列表中有 1,则结果为 1,否则为 0。 def binary_search(l, low=0,high=-1): if not l: retu
我到处搜索以找到将 float 转换为八进制或二进制的方法。我知道 float.hex 和 float.fromhex。是否有模块可以对八进制/二进制值执行相同的工作? 例如:我有一个 float 1
当我阅读有关 list.h 文件中的 hlist 的 FreeBSD 源代码时,我对这个宏感到困惑: #define hlist_for_each_entry_safe(tp, p, n, head,
我不知道出了什么问题,也不知道为什么会出现此错误。我四处搜索,但我终究无法弄明白。 void print_arb_base(unsigned int n, unsigned int b) {
在任何语言中都可以轻松地将十进制转换为二进制,反之亦然,但我需要一个稍微复杂一点的函数。 给定一个十进制数和一个二进制位,我需要知道二进制位是开还是关(真或假)。 示例: IsBitTrue(30,1
在下面的代码中,我创建了两个文件,一个是文本格式,另一个是二进制格式。文件的图标显示相同。但是这两个文件的特征完全相同,包括大小、字符集(==二进制)和流(八位字节)。为什么没有文本文件?因为如果我明
我想通读一个二进制文件。谷歌搜索“python binary eof”引导我here . 现在,问题: 为什么容器(SO 答案中的 x)不包含单个(当前)字节而是包含一大堆字节?我做错了什么? 如果应
为什么只允许以 10 为基数使用小数点?为什么以下会引发语法错误? 0b1011101.1101 我输入的数字是否有歧义?除了 93.8125 之外,字符串似乎没有其他可能的数字 同样的问题也适用于其
boost 库中有二进制之类的东西吗?例如我想写: binary a; 我很惭愧地承认我曾尝试找到它(Google、Boost)但没有结果。他们提到了一些关于 binary_int<> 的内容,但我既
我是一名优秀的程序员,十分优秀!