Julie
Julie

Reputation: 189

In Java, byte[] vs string as a method parameter have any pros/cons?

I have a tab delimited file and I need to pass it around. I will be using BufferedReader to read lines. In that case does passing it as a byte[] vs String have any advantages and disadvantages.

If the file contains json data, would passing around as byte[] vs string have any advantages

Upvotes: 0

Views: 154

Answers (1)

Amadan
Amadan

Reputation: 198324

No. JSON should be a String, since it has an encoding and a meaning. byte[] is generally a physical, uninterpreted sequence of bytes; String is a sequence of characters.

Upvotes: 1

Related Questions