• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

File transfer using Java Http

 
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've got a program that's using POJO's to do a little web server that takes commands. It works great, and it's tiny. But I'm not sure how to extend it to accept an inbound file transfer. Can anyone give me some coding advice for binary file transfer (sans the advice to install a web server...sorry, just not going to do that, this needs to REMAIN tiny). Below is the code I'm using. It's not going to compile out of the box for you...here to give you an idea about what I'm starting with.



 
Sheriff
Posts: 22862
132
Eclipse IDE Spring TypeScript Quarkus Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A binary file transfer is basically the same as text transfer but without using Writer and Reader, but sticking to InputStream and OutputStream (possibly wrapped in other streams).
 
Dale Seng
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rob Prime wrote:A binary file transfer is basically the same as text transfer but without using Writer and Reader, but sticking to InputStream and OutputStream (possibly wrapped in other streams).


Thanks Rob, for the ideas.

As you see in my code, I'm just expecting GET requests and looking at the plain text of the request. If set-up for handling a POST, you suggest I use an input stream and pull the form data, where the other party will have stuffed the binary? Sounds like there's enough here to embark on a trial, but I would expect to be reinventing the wheel (and finding the same bumps in the road others have found). Would you (or anyone) have any suggestions on where to find some sample code?

--Dale--
 
reply
    Bookmark Topic Watch Topic
  • New Topic