提交 7b4e912d 编写于 作者: P Patrick Forhan

Merge pull request #75 from square/jw/byte-me

Remove unused ByteSink classes.
// Copyright 2010 Square, Inc.
package retrofit.io;
import java.io.IOException;
/**
* An interface equivalent to OutputStream.
*
* @author Bob Lee (bob@squareup.com)
*/
public interface ByteSink {
/**
* Writes the specified number of bytes from buffer.
*/
void write(byte[] buffer, int count) throws IOException;
/**
* Closes the sink.
*/
void close() throws IOException;
/**
* Constructs a new sink.
*/
public interface Factory {
/**
* Constructs a new sink.
*/
ByteSink newSink() throws IOException;
}
}
// Copyright 2010 Square, Inc.
package retrofit.io;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
/**
* Utility methods for dealing with byte sinks.
*
* @author Bob Lee (bob@squareup.com)
*/
public class ByteSinks {
/**
* Creates a sink that writes to a file.
*/
public static ByteSink.Factory forFile(final File file) {
return new ByteSink.Factory() {
public ByteSink newSink() throws IOException {
final FileOutputStream out = new FileOutputStream(file);
return new ByteSink() {
public void write(byte[] buffer, int count) throws IOException {
out.write(buffer, 0, count);
}
public void close() throws IOException {
out.getFD().sync();
out.close();
}
};
}
};
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册