I am using the spongyCastle library in my Android class and I have the following implementation:
StringWriter stringWriter = new StringWriter();
PemWriter pemWriter = new PEMWriter(stringWriter);
pemWriter.writeObject(someObject);
//Printing the stringWriter here prints nothing
pemWriter.close();
//Printing the stringWriter here prints the correct content
I do not understand this behavior of PemWriter. This does not generally happen with other Writers i.e close() method should not be necessarily called to write the content. Can someone please clear my confusion?