java - Writer or OutputStream? -
i'm designing library class should have ability able convert internals text. class shall use: outputstream
or writer
? , key difference between them (in case)?
public interface memento { void save(outputstream stream); void save(writer writer); }
which one?
an outputstream
byte-oriented stream. text write has encoded bytes using encoding (most commonly iso-8859-1 or utf-8). writer
character-oriented stream may or may not internally encode characters bytes, depending on writing to.
edit if designing library, if provide outputstream
-oriented interface text written, should provide client classes ability control encoding used.
Comments
Post a Comment