Danadir
Danadir

Reputation: 11

Converting any file into binary in java

Anyone know how can I read any file in binary using Java? I want to be able to read any image, document, pdf etc as a stream of binary digits. Thanks

Upvotes: 0

Views: 4279

Answers (2)

wesoly
wesoly

Reputation: 552

use FileInputStream

FileInputStream is meant for reading streams of raw bytes such as image data. For reading streams of characters, consider using FileReader.

Upvotes: 1

ZoFreX
ZoFreX

Reputation: 8920

Sounds like you want FileInputStream! You may find the Basic I/O tutorial useful too.

Upvotes: 3

Related Questions