18 lines
435 B
Dart
18 lines
435 B
Dart
import 'dart:io';
|
|
|
|
import 'Stream.dart';
|
|
import 'Tag.dart';
|
|
import 'impl/CompoundTag.dart';
|
|
|
|
class SnbtIo {
|
|
static void write(String file, CompoundTag tag) {
|
|
File handle = File(file);
|
|
|
|
if (handle.existsSync())
|
|
handle.deleteSync(); // Ensure we flush the file to 0 bytes
|
|
|
|
StringBuilder builder = StringBuilder();
|
|
Tag.writeStringifiedNamedTag(tag, builder, 0);
|
|
handle.writeAsString(builder.toString());
|
|
}
|
|
}
|