0
我有一個Java可序列化的對象,我想寫/從一個文件讀取該對象。 然而,谷歌應用程序引擎不支持FileOutputStream中和ObjectOutputStream的,所以我的序列化對象轉換爲字節數組,並將其寫入到文件寫入/讀取字節數組從/到文件java
$FileWriteChannel writeChannel = fileService.openWriteChannel(
writableFile, lockForWrite);
$writeChannel.write(ByteBuffer.wrap(bytearray));
$writeChannel.closeFinally();
然後我讀了文件:
AppEngineFile readableFile = new AppEngineFile(filename);
FileReadChannel readChannel = fileService.openReadChannel(readableFile, lockForRead);
BufferedReader reader = new BufferedReader(Channels.newReader(readChannel, "UTF-8"));
String line = reader.toString();
我看到日誌和UTF-8錯誤 任何人都可以告訴我我做錯了什麼嗎?
錯誤日誌:
cloud.spam.filter.server.SerializationObject file_io: An error message: invalid stream header: 5B4240312012/07/06 08:00:10
謝謝
請提供錯誤日誌。 – 2012-07-06 08:10:10