Posts

Showing posts from March 5, 2019

Curculionidae

Image
Curculionidae Classificação científica Reino: Animalia Filo: Arthropoda Classe: Insecta Ordem: Coleoptera Subordem: Polyphaga Superfamília: Curculionoidea Família: Curculionidae

Why is this FileOutputStream creating an empty file?

Image
1 This code creates the file, but it's always empty. I have seen some examples using a StringWriter, but my XML files can become so large, it doesn't seem practical saving it to a writer, converting it to a string, and then writing it to a file. It should be a stream. Or perhaps I don't know what I'm talking about and have totally confused myself. private void createXMLfile(File file, long folderRoot) throws IllegalArgumentException, IllegalStateException, IOException { // https://developer.android.com/reference/org/xmlpull/v1/XmlSerializer // https://stackoverflow.com/questions/5181294/how-to-create-xml-file-in-android file.createNewFile(); FileOutputStream fileOutputStream = new FileOutputStream(file); XmlSerializer serializer = Xml.newSerializer(); serializer.s