in beschriebene Datei Daten nachträglich hinzufügen?



  • Hallo,

    ich habe eine beschriebene Datei und diese Datei möchte ich später Daten hinzufügen, muss ich etwa die ganze Datei immer wieder neu einlesen und mit den neuen Daten die Datei beschreiben oder kann ich auch am Ende der Datei oder am Anfang der Datei Daten hinzufügen??

    Danke für die Hilfe.



  • Was man in der API nicht alles findet...

    public FileOutputStream(File file, boolean append) throws FileNotFoundException

    Creates a file output stream to write to the file represented by the specified File object. If the second argument is true, then bytes will be written to the end of the file rather than the beginning. A new FileDescriptor object is created to represent this file connection.

    First, if there is a security manager, its checkWrite method is called with the path represented by the file argument as its argument.

    If the file exists but is a directory rather than a regular file, does not exist but cannot be created, or cannot be opened for any other reason then a FileNotFoundException is thrown.

    Parameters:
    file - the file to be opened for writing.
    append - if true, then bytes will be written to the end of the file rather than the beginning


Anmelden zum Antworten