Java I/O stream definition and subtypes -


i'm new i/o in java, , read in 1 of posts on site that:

all streams behave in same manner, if actual physical devices linked differ. thus, same i/o classes , methods can applied type of device

quoted from: stream definition

what can't wrap head around how streams (take different byte stream subtypes example - bufferedinputstream, filterinputstream, objectinputstream, .., etc.) behave in same manner , can connected physical device, when implemented different classes supposedly offer varying functionality , accomodate different sources/destinations? example, can use objectinputstream or fileoutputstream read , write console? different streams, different devices, , (streams) can connected (devices) - i'm @ loss here..

the quote not can connect any stream any device, saying. there different implementations of inputstream , outputstream connect specific devices - example, fileinputstream connects file on filesystem, , bytearrayinputstream connects byte array in memory.

the main idea quote explaining different kinds of streams extensions of classes inputstream , outputstream, can common operations on streams using of specific kinds of streams, regardless of specific kind of stream reads or writes data or to.

some streams wrappers around other streams, adding specific functionality. example, bufferedoutputstream adds buffering underlying stream. useful because streams, writing in blocks more efficient writing byte byte - bufferedoutputstream collects bytes write buffer, written underlying stream 1 block. objectoutputstream wrapper, adds functionality convert serializable java objects bytes can written underlying stream.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -