jiazhai commented on a change in pull request #43: DLFS - A filesystem built on replicated logs URL: https://github.com/apache/distributedlog/pull/43#discussion_r146567681
########## File path: distributedlog-contribs/distributedlog-hdfs/src/main/java/com/twitter/distributedlog/fs/DistributedLogOutputStream.java ########## @@ -0,0 +1,52 @@ +package com.twitter.distributedlog.fs; + +import com.twitter.distributedlog.AppendOnlyStreamWriter; +import com.twitter.distributedlog.DistributedLogManager; + +import java.io.IOException; +import java.io.OutputStream; + +/** + * DistributedLog Output Stream + */ +class DistributedLogOutputStream extends OutputStream { + + private final DistributedLogManager dlm; + private final AppendOnlyStreamWriter streamWriter; + + DistributedLogOutputStream(DistributedLogManager dlm, + AppendOnlyStreamWriter streamWriter) { + this.dlm = dlm; + this.streamWriter = streamWriter; + } + + @Override + public void write(int b) throws IOException { + byte[] data = new byte[] { (byte) b }; + write(data); + } + + @Override + public void write(byte[] b) throws IOException { + streamWriter.write(b); + } + + @Override + public void write(byte[] b, int off, int len) throws IOException { + // TODO: improve AppendOnlyStreamWriter Review comment: Shall we open a github issue for this "todo"? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services