D
D
Daniel2018-02-12 20:22:14
Java
Daniel, 2018-02-12 20:22:14

How can I read a file (video, any) in one line and send it via a socket to a client.?

On the server I read the file in ONE LINE . I read line by line. I replace all newlines and send to the client, the client restores the newlines and saves the file on his machine. The problem appears with the encoding, when transferring a picture or video, the file is displayed in a different encoding. How to solve this problem, how to determine the file encoding, or you can somehow without encoding, for example, compress the file into an archive.
And is it correct to read the file line by line using BufferedReader fr=new BufferedReader(new FileReader(file))

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
aol-nnov, 2018-02-12
@aol-nnov

is it correct to read a binary file line by line?
if we discard the fact that the sir asks for heresy, then no, this is not correct!

Y
Yerlan Ibraev, 2018-02-13
@mad_nazgul

Use Base64 not?!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question