private void writeInternal (Object object) throws YamlException {
		try {
			if (!started) {
				emitter.emit(Event.STREAM_START);
				started = true;
			}
			emitter.emit(new DocumentStartEvent(config.writeConfig.explicitFirstDocument, null, null));
			isRoot = true;
			writeValue(object, config.writeConfig.writeRootTags ? null : object.getClass(), null, null);
			emitter.emit(new DocumentEndEvent(config.writeConfig.explicitEndDocument));
		} catch (EmitterException ex) {
			throw new YamlException("Error writing YAML.", ex);
		} catch (IOException ex) {
			throw new YamlException("Error writing YAML.", ex);
		}
	}