本文主要是介绍Ali MaxCompute SDK,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
ALI MC 文件读写
public abstract BufferedInputStream readResourceFileAsStream(String var1) throws IOException;
LocalExecutionContext.java
@Overridepublic BufferedInputStream readResourceFileAsStream(String resourceName) throws IOException {try {return wareHouse.readResourceFileAsStream(wareHouse.getOdps().getDefaultProject(),resourceName, ',');} catch (OdpsException e) {throw new IOException(e.getMessage());}}
WareHouse.java
public BufferedInputStream readResourceFileAsStream(String project, String resource,char inputColumnSeperator)throws IOException, OdpsException {if (!existsResource(project, resource)) {DownloadUtils.downloadResource(WareHouse.getInstance().getOdps(), getOdps().getDefaultProject(), resource, getLimitDownloadRecordCount(), inputColumnSeperator);}if (!existsResource(project, resource)) {throw new OdpsException("File Resource " + project + "." + resource + " not exists");}File file = getReourceFile(project, resource);if (!file.isFile()) {throw new OdpsException("Resource " + project + "." + resource+ " is not a valid file Resource, because it is a direcotry");}return new BufferedInputStream(new FileInputStream(file));}
JDK BufferedInputStream
/*** A <code>BufferedInputStream</code> adds* functionality to another input stream-namely,* the ability to buffer the input and to* support the <code>mark</code> and <code>reset</code>* methods. When the <code>BufferedInputStream</code>* is created, an internal buffer array is* created. As bytes from the stream are read* or skipped, the internal buffer is refilled* as necessary from the contained input stream,* many bytes at a time. The <code>mark</code>* operation remembers a point in the input* stream and the <code>reset</code> operation* causes all the bytes read since the most* recent <code>mark</code> operation to be* reread before new bytes are taken from* the contained input stream.** @author Arthur van Hoff* @since JDK1.0*/
public
class BufferedInputStream extends FilterInputStream {private static int DEFAULT_BUFFER_SIZE = 8192;
这篇关于Ali MaxCompute SDK的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!