나는이 Java Tutorial 다음 초보 프로그래머입니다."DataOutputStream"과 "ObjectOutputStream"의 차이
섹션의 두 번째 클래스는 Data Streams 및 Object Streams입니다. ObjectInputStream
위해 나는 그것이 DataInputStreams
원시 객체에 사용되는 것을 말한다 알고
DataInputStream
에 대한
out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(dataFile)));
// ..
in = new DataInputStream(new BufferedInputStream(new FileInputStream(dataFile)));
및
out = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(dataFile)));
// ..
in = new ObjectInputStream(new BufferedInputStream(new FileInputStream(dataFile)));
및 ObjectInputStreams
이 사용됩니다 :
그들은 아주 이와 비슷하게 사용된다 개체 (및 그 개체의 직렬화)를 사용해야합니까? 둘 다 기본 유형을 사용하는 두 예제 클래스 사이에는 눈에 띄는 차이가 없습니다. 나는 보통 원시 타입도 사용한다.
성능면에서 어느 것이 더 좋습니까? 다른 큰 차이점이 있습니까?
감사합니다.