append w tym miejscu ktorym chce

0

Potrzebuje zapisac pewne dane do xml zeby wyswietlic to na stronce
uzywam serializacji i clasy FileOutputStream.
Problem w tym ze chce za pomoca buttona dodawac nastepne dane ale przy nowym kliknieciu nadpisuje plik zamiast
dopisac nowe, stare sa tracone.
Jest w niej taki konstruktor FileOutputStream(String name, boolean append)
uzylem go i dziala dopisuje nowe wartosci niestety za ostatnim wyrazem a co za tym idzie za konczacym znaczniikiem.
Wie moze ktos czy mozna ustawic appnd tak zeby mi dopisywalam tam gdzie chce??
Moze jakies inne rozwiazanie??

0

tak to tylko w erze panie...
Nie da się dopisać czegoś w środku pliku. Możesz przenieść gdzieś (inny plik, pamięć) to co ma być za dopisywanym tekstem, dopisać nowy tekst i z powrotem (hm tak się pisze?) dodać to co tam ma być

0

A moze takie cus ??
Appendable append(CharSequence csq,
int start,
int end)
throws IOException
Appends a subsequence of the specified character sequence to this Appendable.
An invocation of this method of the form out.append(csq, start, end) when csq is not null, behaves in exactly the same way as the invocation

 out.append(csq.subSequence(start, end)) 

Parameters:
csq - The character sequence from which a subsequence will be appended. If csq is null, then characters will be appended as if csq contained the four characters "null".
start - The index of the first character in the subsequence
end - The index of the character following the last character in the subsequence
Returns:
A reference to this Appendable
Throws:
IndexOutOfBoundsException - If start or end are negative, start is greater than end, or end is greater than csq.length()
IOException - If an I/O error occurs

Znalazlem w dokumentacji jest start i end chyba za to odpowiada ze podajesz po jakim wyrazie wpisuje :p slabo angielski znam (nie smiac sie jak to do czego innego)
:P tylko nie umiem uzyc bledy wyrzuca.

A moze macie jakies swoje sposoby zeby tworzyc xml??
wpisyjesz dane w jTextField klikasz button zapisuje je (tworzy sie tablica z nimi przy pomocy xsl wyswietam ja na stronie) dajesz nowe dane
klikasz (i dopisuje nowy wiersz w tablicy )
O cos takiego mi chodzi tylko gorzej z wykonaniem ............

1 użytkowników online, w tym zalogowanych: 0, gości: 1