本文整理汇总了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);
}
示例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();
}
}
示例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();
}
示例4: getExternalSource
import com.cloudera.sqoop.io.LobFile; //导入方法依赖的package包/类
@Override
protected Reader getExternalSource(LobFile.Reader reader)
throws IOException {
return reader.readClobRecord();
}
示例5: getExternalSource
import com.cloudera.sqoop.io.LobFile; //导入方法依赖的package包/类
@Override
protected InputStream getExternalSource(LobFile.Reader reader)
throws IOException {
return reader.readBlobRecord();
}
示例6: LobReaderCache
import com.cloudera.sqoop.io.LobFile; //导入方法依赖的package包/类
protected LobReaderCache() {
this.readerMap = new TreeMap<Path, LobFile.Reader>();
}
示例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;