Java programming part 44 Java Input and Output 7 DataOutSteam an DataInputStream

preview_player
Показать описание
Java Programming tutorial, Java Input and Output; DataOutputStream and DataInputStream, used for writing primitive data types to files and reading them back again, from int, float, double, bytes ect.
Рекомендации по теме
Комментарии
Автор

Thank you for your input, I appreciate it.

fitmadefun
Автор

Yes Kevin, You could use lots of try and catches, fr different file types, an another try catch for an unidentified file format. Testing the files extensions on the file names within the directory trees. you could even use another inputstream, maybe one for video file extension from JMF.

Redemptie
Автор

I'm willing to bet its my implementation that is causing the lag. I am reading in files byte by byte because I thought it would be quicker to compare the actual bytes then to create substrings to get the extensions, well i should check the API there may be a method for that. But you're right if I can read the files in quickly I could hash that sort of string data in an instant. But I'm not sure how I'd identify like files in different directories as duplicates in that case.

fitmadefun
Автор

What if we don't know the type of file we're reading but we will have to read several types of files? For example iterating through a file tree.I decided reading the binary data would be a uniformed way to accomplish this. The data would be hashed and compared to determine equality. So specifically I need to read a file of an unknown type in a way that will return the same value if the files are duplicates and do it in a reasonable amount of time. I'd appreciate your input.

fitmadefun
Автор

HI Kevin,

Your are right if it is taking 45 minutes to read a file. Then that is way to much time. It would probably be the Java Media Framework API (JMF) for the video or audio. I did nt realize that it took s long.

Redemptie
Автор

I realize that sounds like it'll work and it does but I tested it on a video (about 9mb) and it took something like 45 minutes imagine recursively reading in an entire directory at that speed...

fitmadefun
Автор

I cant understand anything you're saying....

ulisesgonzalezzuniga
join shbcf.ru