ZnodeNewWizardComposite1.java 文件源码

java
阅读 22 收藏 0 点赞 0 评论 0

项目:eZooKeeper 作者:
@Override
public byte[] getZnodeData() throws Exception {
    Text filePathText = (Text) getControl(CONTROL_NAME_DATA_FILE_TEXT);
    String filePath = filePathText.getText();
    File file = new File(filePath);
    String fileName = file.getName();
    if (!file.exists()) {
        throw new IOException("File '" + fileName + "' does not exist.");
    }

    if (!file.isFile()) {
        throw new IOException("Path '" + filePath + "' is not a valid file.");
    }

    long length = file.length();

    if (length > Znode.MAX_DATA_SIZE) {
        throw new Exception("File '" + fileName
                + "' size is greater than the maximum allowed Znode data size (" + Znode.MAX_DATA_SIZE
                + " bytes).");
    }

    FileEditor fileEditor = new FileEditor(file);
    return fileEditor.read();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号