You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to odata4j-discuss
I have been experimenting with odata4j using the Northwind OData
Service. I noticed that the Employees and Categories entity sets
contain photos and pictures. After some investigation I have managed
to extract the BMP images but only by discarding the first 78 bytes of
the byte array. This is an artefact of Northwind's Access heritage.
The 78 superfluous bytes are a proprietary OLE header that Access
creates when saving bitmaps.
The code below currently works, imagine we wanted the Nancy Davolio
image (employee number 1):
ODataConsumer c = ODataConsumer.create(NORTHWIND);
employee1 = (OEntity)
c.getEntities("Employees").top(1).execute().first();
byte[] photo = employee1.getProperty("Photo",
byte[].class).getValue();
byte[] data = new byte[photo.length - 78];
System.arraycopy(photo, 78, data, 0, photo.length - 78);
File f = new File("employee1.bmp");
FileUtils.writeByteArrayToFile(f,data);
If these unnecessary 78 bytes were removed from the service the base64
encoded string would even work as a dataurl and could be useful for
JSON based applications.
John Spurlock
unread,
Jul 7, 2011, 8:26:53 PM7/7/11
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to odata4j...@googlegroups.com
Microsoft hosts and is responsible for the northwind data service (just as they provide the northwind mssql sample db). This is an old dataset, and it is microsoft after all, so I'm not surprised to hear about the OLE cruft in there.
Not sure what exactly you're proposing we do about it, but thanks for pointing it out! : )
Mike Graham
unread,
Sep 8, 2015, 3:40:53 PM9/8/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to odata4j-discuss
if you are on the client side, don't forget that the 78 bytes that need to be stripped off are actually 104 bytes when base64 encoded.