cofactor
asked on
DataInputStream/DataOutputStream
i dont understand the use of DataInputStream/Dataoutput Stream. It is called , these classes are usued for primitive types(int, char etc).
means what ? suppose i have a file which contains like below..
12 A B C 1245
so these are primitive data, because these are ints, chars READABLE things, right ? so i CAN use datainputstream to read these data ? but same thing i could do it using a FIleReader!!....is not it ?
so , dont u think DataInputStream/Dataoutput Stream is a redundant class ? (bocz FileReader/ FileWriter can do theirs job !!)
means what ? suppose i have a file which contains like below..
12 A B C 1245
so these are primitive data, because these are ints, chars READABLE things, right ? so i CAN use datainputstream to read these data ? but same thing i could do it using a FIleReader!!....is not it ?
so , dont u think DataInputStream/Dataoutput
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
eg. writeInt(1) does not write the character '1' to the file it writes the binary representation (4 bytes) of the integer 1
ASKER
>eg. writeInt(1) does not write the character '1' to the file >it writes the binary representation (4 bytes) of the >integer 1
ohh. that means, it is taking a primitive param (here integer 1 ) but outputing a binary result.
what will happen when it will use readInt() ?
Filereader,Filewriter does txt--->txt conversion , so here is the difference ! right ?
ohh. that means, it is taking a primitive param (here integer 1 ) but outputing a binary result.
what will happen when it will use readInt() ?
Filereader,Filewriter does txt--->txt conversion , so here is the difference ! right ?
> what will happen when it will use readInt() ?
It will read the next 4 bytes and interpret them as an integer
> Filereader,Filewriter does txt--->txt conversion , so here is the difference ! right ?
sort of, you actually write chars to a writer
It will read the next 4 bytes and interpret them as an integer
> Filereader,Filewriter does txt--->txt conversion , so here is the difference ! right ?
sort of, you actually write chars to a writer
ASKER
plz explain a little bit.