package com.atlassian.bitbucket.mesh.io;

import java.io.Closeable;
import java.io.IOException;
import java.io.Writer;

public class NullTerminatedWriter implements Closeable {

    private final Writer writer;

    public NullTerminatedWriter(Writer writer) {
        this.writer = writer;
    }

    public void writeSegment(String s) throws IOException {
        writer.write(s);
        writer.write('\0');
    }

    @Override
    public void close() throws IOException {
        writer.close();
    }
}
