当前位置: 首页>>代码示例>>Java>>正文


Java LobFile.Reader方法代码示例

本文整理汇总了Java中com.cloudera.sqoop.io.LobFile.Reader方法的典型用法代码示例。如果您正苦于以下问题:Java LobFile.Reader方法的具体用法?Java LobFile.Reader怎么用?Java LobFile.Reader使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.cloudera.sqoop.io.LobFile的用法示例。


在下文中一共展示了LobFile.Reader方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: get

import com.cloudera.sqoop.io.LobFile; //导入方法依赖的package包/类
/**
 * Open a LobFile for read access, returning a cached reader if one is
 * available, or a new reader otherwise.
 * @param path the path to the LobFile to open
 * @param conf the configuration to use to access the FS.
 * @throws IOException if there's an error opening the file.
 */
public LobFile.Reader get(Path path, Configuration conf)
    throws IOException {

  LobFile.Reader reader = null;
  Path canonicalPath = qualify(path, conf);
  // Look up an entry in the cache.
  synchronized(this) {
    reader = readerMap.remove(canonicalPath);
  }

  if (null != reader && !reader.isClosed()) {
    // Cache hit. return it.
    LOG.debug("Using cached reader for " + canonicalPath);
    return reader;
  }

  // Cache miss; open the file.
  LOG.debug("No cached reader available for " + canonicalPath);
  return LobFile.open(path, conf);
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:28,代码来源:LobReaderCache.java

示例2: recycle

import com.cloudera.sqoop.io.LobFile; //导入方法依赖的package包/类
/**
 * Return a reader back to the cache. If there's already a reader for
 * this path, then the current reader is closed.
 * @param reader the opened reader. Any record-specific subreaders should be
 * closed.
 * @throws IOException if there's an error accessing the path's filesystem.
 */
public void recycle(LobFile.Reader reader) throws IOException {
  Path canonicalPath = reader.getPath();

  // Check if the cache has a reader for this path already. If not, add this.
  boolean cached = false;
  synchronized(this) {
    if (readerMap.get(canonicalPath) == null) {
      LOG.debug("Caching reader for path: " + canonicalPath);
      readerMap.put(canonicalPath, reader);
      cached = true;
    }
  }

  if (!cached) {
    LOG.debug("Reader already present for path: " + canonicalPath
        + "; closing.");
    reader.close();
  }
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:27,代码来源:LobReaderCache.java

示例3: finalize

import com.cloudera.sqoop.io.LobFile; //导入方法依赖的package包/类
@Override
protected synchronized void finalize() throws Throwable {
  for (LobFile.Reader r : readerMap.values()) {
    r.close();
  }

  super.finalize();
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:9,代码来源:LobReaderCache.java

示例4: getExternalSource

import com.cloudera.sqoop.io.LobFile; //导入方法依赖的package包/类
@Override
protected Reader getExternalSource(LobFile.Reader reader)
    throws IOException {
  return reader.readClobRecord();
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:6,代码来源:ClobRef.java

示例5: getExternalSource

import com.cloudera.sqoop.io.LobFile; //导入方法依赖的package包/类
@Override
protected InputStream getExternalSource(LobFile.Reader reader)
    throws IOException {
  return reader.readBlobRecord();
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:6,代码来源:BlobRef.java

示例6: LobReaderCache

import com.cloudera.sqoop.io.LobFile; //导入方法依赖的package包/类
protected LobReaderCache() {
  this.readerMap = new TreeMap<Path, LobFile.Reader>();
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:4,代码来源:LobReaderCache.java

示例7: getExternalSource

import com.cloudera.sqoop.io.LobFile; //导入方法依赖的package包/类
/**
 * Using the LobFile reader, get an accessor InputStream or Reader to the
 * underlying data.
 */
protected abstract ACCESSORTYPE getExternalSource(LobFile.Reader reader)
    throws IOException;
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:7,代码来源:LobRef.java


注:本文中的com.cloudera.sqoop.io.LobFile.Reader方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。