Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
305 views
in Technique[技术] by (71.8m points)

java - file reading writing using multithreading

I want to make a program in java in which one thread is reading a file and other is writing in

it. Anybody please provide me any reference link where I can find the code snippets for the

same?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You shouldn't read and write to a file at the same time. In the best case, you'll end up with corrupted data, or an IO error.

If it's for inter-process communication, you should instead use sockets or higher-level systems like JMS.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...