java - Passing binary blob through a content provider -
I have a content provider that is custom in the set of my Android applications, and it needs to expose anything The URI for the small (20-30KB) byte array these blobs looks like this:
Content: //my.authority/blob/#
Where #
is the row number; As a result the cursor has the standard _id
column and a data column. The provider's query ()
method:
byte [] byteData = getMyByteData () I am using matrix concert
; Matrix Cursors MC = New Matrix Concert (COLUMNS); Mc.addRow (new object [] {id, byte data});
Later, in the application consuming data, I do:
cursor c = managed (uri, null, null, null , Null); C.moveToFirst (); Byte [] data = c.getBlob (c.getColumnIndexOrThrow ("data"));
However, the data does not contain the contents of my original byte array; Rather, there is something like [B @ 435cc518
, which looks like an array address compared to content, I wrap the byte array in the implementation of java.sql.blob
Tried, it is finding out that the Content Provider Subsystem was written due to being easy to use with Lilate, but this help
Has anyone earned it to work? If the data was in the file system then there are methods in ContentProvider
that can be used to provide a martial InputStream
to the client, but the data that I try to send I am back in the form of a resource in the APK of the content provider.
You to send byte array> matrix concert
is because it < Depending on the code> AbstractCursor # fillWindow method that fills the CursorWindow
using Object # toString
. So what is happening is that the byte array is being called by the toString
method and it is accumulated that instead of the content of the byte array, which you want. The only way around this is that I can see that my own cursor is implemented, which will fill the cursor window
properly for a byte array.
Comments
Post a Comment