There is a task: You need to create a client and a REST web-service in java .

  • The client must create an InputStream and transfer it to the service, after which every 10 seconds (or another interval is not important), add new data portions to it.

  • the service should have a method that takes an InputStream as an argument and outputs the received data to the log.

(You can send the service information about the number of files that will be transferred to the service, so that the service knows when it is possible to complete the data reception)

ideally, the stream should be a tar archive, and in the form of data, text files should appear in the stream ..

PS : the solution should be exactly on the InputStream:

unsuitable:

  • web socket solutions;

  • sending text files with client separate requests for service

I would be grateful for links, tips, code examples ..

  • one
    conditions conditions, but why reinvent the wheel? strange people who give such tasks - Tsyklop
  • 2
    InputStream is a class in Java. Data is transmitted in the form of bytes for IS works with bytes. You need to raise the Socket (this is not a web socket) connection and send there anything. - Tsyklop
  • @Tsyklop, thanks .. for the answer. I understand the difference between the socket and the web socket ... I also immediately suggested this option ... but I was stunned - "do not use sockets" ... you can also send a bunch of files separately and the balancer will perform load distribution for individual service instances .. but the meaning of the task, as I explained, is precisely to create a stream from the .tar archive and transfer files to it ... - Vitaly Vikhlyaev
  • And on what REST will be written? mean on spring? or not? - Tsyklop
  • one
    Well ... Raise IS . and in the vayle read bytes and write to the open HttpUrlConnection . After each read, do a Thread.sleep . - Tsyklop

0