Meaningless Drivel is fun!*
The moose likes Sockets and Internet Protocols and the fly likes File transfer using Java Http Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "File transfer using Java Http" Watch "File transfer using Java Http" New topic
Author

File transfer using Java Http

Dale Seng
Ranch Hand

Joined: Mar 22, 2004
Posts: 275
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.



Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19722
    
  20

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).


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Dale Seng
Ranch Hand

Joined: Mar 22, 2004
Posts: 275
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--
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: File transfer using Java Http