001: package com.jclark.xml.output;
002:
003: import java.io.Writer;
004: import java.io.IOException;
005:
006: public class SyncXMLWriter extends XMLWriter {
007: private XMLWriter w;
008:
009: public SyncXMLWriter(XMLWriter w) {
010: super (w);
011: this .w = w;
012: }
013:
014: public void write(char cbuf[], int off, int len) throws IOException {
015: synchronized (lock) {
016: w.write(cbuf, off, len);
017: }
018: }
019:
020: public void write(String str) throws IOException {
021: synchronized (lock) {
022: w.write(str);
023: }
024: }
025:
026: public void write(int c) throws IOException {
027: synchronized (lock) {
028: w.write(c);
029: }
030: }
031:
032: public void write(String str, int off, int len) throws IOException {
033: synchronized (lock) {
034: w.write(str, off, len);
035: }
036: }
037:
038: public void close() throws IOException {
039: synchronized (lock) {
040: w.close();
041: }
042: }
043:
044: public void flush() throws IOException {
045: synchronized (lock) {
046: w.flush();
047: }
048: }
049:
050: public void startElement(String name) throws IOException {
051: synchronized (lock) {
052: w.startElement(name);
053: }
054: }
055:
056: public void attribute(String name, String value) throws IOException {
057: synchronized (lock) {
058: w.attribute(name, value);
059: }
060: }
061:
062: public void endElement(String name) throws IOException {
063: synchronized (lock) {
064: w.endElement(name);
065: }
066: }
067:
068: public void processingInstruction(String target, String data)
069: throws IOException {
070: synchronized (lock) {
071: w.processingInstruction(target, data);
072: }
073: }
074:
075: public void comment(String str) throws IOException {
076: synchronized (lock) {
077: w.comment(str);
078: }
079: }
080:
081: public void entityReference(boolean isParam, String name)
082: throws IOException {
083: synchronized (lock) {
084: w.entityReference(isParam, name);
085: }
086: }
087:
088: public void characterReference(int n) throws IOException {
089: synchronized (lock) {
090: w.characterReference(n);
091: }
092: }
093:
094: public void cdataSection(String content) throws IOException {
095: synchronized (lock) {
096: w.cdataSection(content);
097: }
098: }
099:
100: public void markup(String str) throws IOException {
101: synchronized (lock) {
102: w.markup(str);
103: }
104: }
105:
106: public void startReplacementText() throws IOException {
107: synchronized (lock) {
108: w.startReplacementText();
109: }
110: }
111:
112: public void endReplacementText() throws IOException {
113: synchronized (lock) {
114: w.endReplacementText();
115: }
116: }
117:
118: public void startAttribute(String name) throws IOException {
119: synchronized (lock) {
120: w.startAttribute(name);
121: }
122: }
123:
124: public void endAttribute() throws IOException {
125: synchronized (lock) {
126: w.endAttribute();
127: }
128: }
129:
130: }
|