• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Sending binary files

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!

Does anyone know how to send binary files(Photos,soundclips,movieclips)from my MIDlet(MIDP v2) to a server in a efficient but open way. I guess i could make a byte[] of the files, but could e.g a picture be unserialized at the server-end if the server was running C#?? I guess byteorders come into play, right? I have ruled out Web Services because of the overhead and lack of support.

Thanks!
 
Ranch Hand
Posts: 1902
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My knee-jerk reaction (without thinking too deeply into the whole thing) is to suggest UUEncoding the media file and sending it that way as a byte array. I would think that almost any system on the other end could then UUDecode it and process it properly. Then the problem is simply reduced to the issue of handling that known problem, rather than worrying about the nitty-gritty of the hand-off of the data.
 
Henrik �stman
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your answer!
Hmm, maybe but UUEncoding do produce some overhead.
A sample 32 second long 3gp-movieclip captured by my Sony Ericsson K700 went from 314KB to 440KB after encoding to UU. Since customers pay for used bandwidth and the slow speed of GPRS it would be nice to find some other format/protocol that was platform indepentent with minimal overhead.

Enconding to Base64 gave me a filesize of 430KB, better but not good.

I�m open for more suggestions. =)
 
Theodore Casser
Ranch Hand
Posts: 1902
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hadn't thought of that. Hmmm.

Well, I suppose one could find a compression framework that is implemented on multiple systems - not that I know of any off the top of my head - and use that. I'm sure you could find something that uses a common-enough format.

Strange that I'd not thought of the bandwidth issue. Sorry about that.
 
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I believe in many cases you'll be able and it can be best to send the data just as is.

Any competent graphics/video library at the server end will be able to sort out bytecode differences for you.

The other thing is that some formats are themselves highly compressed per se (eg JPG, PNG, video formats).
[ April 19, 2007: Message edited by: Eduardo Marques ]
 
Henrik �stman
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks!

I'm a bit rusty on the details, but when sending a mp4-movieclip over HTTP("binary/octet-stream") doesn't it get converted to charbased Base64 encoding? Isnt't all HTTP connections sending chars(ASCII)? Please correct me if i'm wrong!!

I've also been looking at OBEX(http://en.wikipedia.org/wiki/OBEX), but there is no Java port available.. =(

More feed-back, PLEASE!
 
Henrik �stman
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, i'm wrong. binary encoded HTTP should be fine.
And there are a java port of obex, https://obex4j.dev.java.net/
 
Eduardo Marques
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can send binary data over HTTP in the response body.

Audio/video gets normally streamed that way, even GIF / JPEG files,
whatever ...
 
reply
    Bookmark Topic Watch Topic
  • New Topic