本文整理汇总了Java中org.apache.hadoop.fs.MD5MD5CRC32FileChecksum.write方法的典型用法代码示例。如果您正苦于以下问题:Java MD5MD5CRC32FileChecksum.write方法的具体用法?Java MD5MD5CRC32FileChecksum.write怎么用?Java MD5MD5CRC32FileChecksum.write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.fs.MD5MD5CRC32FileChecksum
的用法示例。
在下文中一共展示了MD5MD5CRC32FileChecksum.write方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doGet
import org.apache.hadoop.fs.MD5MD5CRC32FileChecksum; //导入方法依赖的package包/类
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response
) throws ServletException, IOException {
final PrintWriter out = response.getWriter();
final String path = ServletUtil.getDecodedPath(request, "/getFileChecksum");
final XMLOutputter xml = new XMLOutputter(out, "UTF-8");
xml.declaration();
final ServletContext context = getServletContext();
final DataNode datanode = (DataNode) context.getAttribute("datanode");
final Configuration conf =
new HdfsConfiguration(datanode.getConf());
try {
final DFSClient dfs = DatanodeJspHelper.getDFSClient(request,
datanode, conf, getUGI(request, conf));
final MD5MD5CRC32FileChecksum checksum = dfs.getFileChecksum(path, Long.MAX_VALUE);
MD5MD5CRC32FileChecksum.write(xml, checksum);
} catch(IOException ioe) {
writeXml(ioe, path, xml);
} catch (InterruptedException e) {
writeXml(e, path, xml);
}
xml.endDocument();
}
示例2: doGet
import org.apache.hadoop.fs.MD5MD5CRC32FileChecksum; //导入方法依赖的package包/类
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response
) throws ServletException, IOException {
final PrintWriter out = response.getWriter();
final String path = ServletUtil.getDecodedPath(request, "/getFileChecksum");
final XMLOutputter xml = new XMLOutputter(out, "UTF-8");
xml.declaration();
final ServletContext context = getServletContext();
final DataNode datanode = (DataNode) context.getAttribute("datanode");
final Configuration conf =
new HdfsConfiguration(datanode.getConf());
try {
final DFSClient dfs = DatanodeJspHelper.getDFSClient(request,
datanode, conf, getUGI(request, conf));
final MD5MD5CRC32FileChecksum checksum = dfs.getFileChecksum(path);
MD5MD5CRC32FileChecksum.write(xml, checksum);
} catch(IOException ioe) {
writeXml(ioe, path, xml);
} catch (InterruptedException e) {
writeXml(e, path, xml);
}
xml.endDocument();
}
示例3: doGet
import org.apache.hadoop.fs.MD5MD5CRC32FileChecksum; //导入方法依赖的package包/类
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
final PrintWriter out = response.getWriter();
final String path =
ServletUtil.getDecodedPath(request, "/getFileChecksum");
final XMLOutputter xml = new XMLOutputter(out, "UTF-8");
xml.declaration();
final ServletContext context = getServletContext();
final DataNode datanode = (DataNode) context.getAttribute("datanode");
final Configuration conf = new HdfsConfiguration(datanode.getConf());
try {
final DFSClient dfs = DatanodeJspHelper
.getDFSClient(request, datanode, conf, getUGI(request, conf));
final MD5MD5CRC32FileChecksum checksum = dfs.getFileChecksum(path);
MD5MD5CRC32FileChecksum.write(xml, checksum);
} catch (IOException | InterruptedException ioe) {
writeXml(ioe, path, xml);
}
xml.endDocument();
}
示例4: doGet
import org.apache.hadoop.fs.MD5MD5CRC32FileChecksum; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void doGet(HttpServletRequest request, HttpServletResponse response
) throws ServletException, IOException {
final UnixUserGroupInformation ugi = getUGI(request);
final PrintWriter out = response.getWriter();
final String filename = getFilename(request, response);
final XMLOutputter xml = new XMLOutputter(out, "UTF-8");
xml.declaration();
final Configuration conf = new Configuration(DataNode.getDataNode().getConf());
final int socketTimeout = conf.getInt("dfs.socket.timeout", HdfsConstants.READ_TIMEOUT);
final SocketFactory socketFactory = NetUtils.getSocketFactory(conf, ClientProtocol.class);
UnixUserGroupInformation.saveToConf(conf,
UnixUserGroupInformation.UGI_PROPERTY_NAME, ugi);
final ClientProtocol nnproxy = DFSClient.createNamenode(conf);
try {
final MD5MD5CRC32FileChecksum checksum = DFSClient.getFileChecksum(
filename, nnproxy, socketFactory, socketTimeout);
MD5MD5CRC32FileChecksum.write(xml, checksum);
} catch(IOException ioe) {
new RemoteException(ioe.getClass().getName(), ioe.getMessage()
).writeXml(filename, xml);
}
xml.endDocument();
}
示例5: doGet
import org.apache.hadoop.fs.MD5MD5CRC32FileChecksum; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void doGet(HttpServletRequest request, HttpServletResponse response
) throws ServletException, IOException {
final UnixUserGroupInformation ugi = getUGI(request);
final PrintWriter out = response.getWriter();
final String filename = getFilename(request, response);
final XMLOutputter xml = new XMLOutputter(out, "UTF-8");
xml.declaration();
Configuration daemonConf = (Configuration) getServletContext()
.getAttribute(HttpServer.CONF_CONTEXT_ATTRIBUTE);
final Configuration conf = (daemonConf == null) ? new Configuration()
: new Configuration(daemonConf);
final int socketTimeout = conf.getInt("dfs.socket.timeout", HdfsConstants.READ_TIMEOUT);
final SocketFactory socketFactory = NetUtils.getSocketFactory(conf, ClientProtocol.class);
UnixUserGroupInformation.saveToConf(conf,
UnixUserGroupInformation.UGI_PROPERTY_NAME, ugi);
final ProtocolProxy<ClientProtocol> nnproxy =
DFSClient.createRPCNamenode(conf);
try {
final MD5MD5CRC32FileChecksum checksum = DFSClient.getFileChecksum(
DataTransferProtocol.DATA_TRANSFER_VERSION,
filename, nnproxy.getProxy(), nnproxy, socketFactory, socketTimeout);
MD5MD5CRC32FileChecksum.write(xml, checksum);
} catch(IOException ioe) {
new RemoteException(ioe.getClass().getName(), ioe.getMessage()
).writeXml(filename, xml);
}
xml.endDocument();
}
示例6: doGet
import org.apache.hadoop.fs.MD5MD5CRC32FileChecksum; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void doGet(HttpServletRequest request, HttpServletResponse response
) throws ServletException, IOException {
final PrintWriter out = response.getWriter();
final String filename = getFilename(request, response);
final XMLOutputter xml = new XMLOutputter(out, "UTF-8");
xml.declaration();
final Configuration conf = new Configuration(DataNode.getDataNode().getConf());
final int socketTimeout = conf.getInt("dfs.socket.timeout", HdfsConstants.READ_TIMEOUT);
final SocketFactory socketFactory = NetUtils.getSocketFactory(conf, ClientProtocol.class);
try {
ClientProtocol nnproxy = getUGI(request, conf).doAs
(new PrivilegedExceptionAction<ClientProtocol>() {
@Override
public ClientProtocol run() throws IOException {
return DFSClient.createNamenode(conf);
}
});
final MD5MD5CRC32FileChecksum checksum = DFSClient.getFileChecksum(
filename, nnproxy, socketFactory, socketTimeout);
MD5MD5CRC32FileChecksum.write(xml, checksum);
} catch(IOException ioe) {
writeXml(ioe, filename, xml);
} catch (InterruptedException e) {
writeXml(e, filename, xml);
}
xml.endDocument();
}
示例7: doGet
import org.apache.hadoop.fs.MD5MD5CRC32FileChecksum; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void doGet(HttpServletRequest request, HttpServletResponse response
) throws ServletException, IOException {
final PrintWriter out = response.getWriter();
final String filename = getFilename(request, response);
final XMLOutputter xml = new XMLOutputter(out, "UTF-8");
xml.declaration();
final Configuration conf = new HdfsConfiguration(DataNode.getDataNode().getConf());
final int socketTimeout = conf.getInt(DFSConfigKeys.DFS_CLIENT_SOCKET_TIMEOUT_KEY, HdfsConstants.READ_TIMEOUT);
final SocketFactory socketFactory = NetUtils.getSocketFactory(conf, ClientProtocol.class);
try {
ClientProtocol nnproxy = getUGI(request, conf).doAs
(new PrivilegedExceptionAction<ClientProtocol>() {
@Override
public ClientProtocol run() throws IOException {
return DFSClient.createNamenode(conf);
}
});
final MD5MD5CRC32FileChecksum checksum = DFSClient.getFileChecksum(
filename, nnproxy, socketFactory, socketTimeout);
MD5MD5CRC32FileChecksum.write(xml, checksum);
} catch(IOException ioe) {
writeXml(ioe, filename, xml);
} catch (InterruptedException e) {
writeXml(e, filename, xml);
}
xml.endDocument();
}