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


Java Utils.inputStreamToStringBuffer方法代码示例

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


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

示例1: getErrorLogs

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
public StringBuffer getErrorLogs() {
    StringBuffer errors = null;
    File logsDir = new File(getProperties().getContainerDirectory(), "logs");
    if (!isWindows()) {
        File catalinaErr = new File(logsDir, "catalina.err");
        if (catalinaErr.exists()) {
            try {
                FileInputStream in = new FileInputStream(catalinaErr);
                errors = Utils.inputStreamToStringBuffer(in);
                in.close();
            } catch (Exception ex) {
                ex.printStackTrace();
                errors = new StringBuffer();
                errors.append("Could not load error log file: " + ex.getMessage());
            }
        }
    } else {
        errors = new StringBuffer();
    }
    return errors;
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:22,代码来源:Tomcat6ServiceContainer.java

示例2: loadResource

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
protected static String loadResource(String resourceName) throws IOException {
    String resource = null;
    synchronized (resourceMap) {
        if (resourceMap.containsKey(resourceName)) {
            resource = resourceMap.get(resourceName);
        } else {
            InputStream stream = ClassUtils.getResourceAsStream(
                SDK44EncodingUtils.class, resourceName);
            if (stream != null) {
                StringBuffer buffer = Utils.inputStreamToStringBuffer(stream);
                resource = buffer.toString();
                resourceMap.put(resourceName, resource);
                stream.close();
            }
        }
    }
    return resource;
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:19,代码来源:SDK44EncodingUtils.java

示例3: loadResource

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
protected static String loadResource(String resourceName) throws IOException {
    String resource = null;
    synchronized (resourceMap) {
        if (resourceMap.containsKey(resourceName)) {
            resource = resourceMap.get(resourceName);
        } else {
            InputStream stream = ClassUtils.getResourceAsStream(
                SDK42EncodingUtils.class, resourceName);
            if (stream != null) {
                StringBuffer buffer = Utils.inputStreamToStringBuffer(stream);
                resource = buffer.toString();
                resourceMap.put(resourceName, resource);
                stream.close();
            }
        }
    }
    return resource;
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:19,代码来源:SDK42EncodingUtils.java

示例4: addCql2TypesMappingToWsdd

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
public static void addCql2TypesMappingToWsdd(File wsddFile) throws IOException {
    LOG.debug("Adding CQL 2 types mapping to wsdd " + wsddFile.getAbsolutePath());
    // read the existing WSDD file in
    FileInputStream wsddStream = new FileInputStream(wsddFile);
    StringBuffer wsdd = Utils.inputStreamToStringBuffer(wsddStream);
    wsddStream.close();
    // remove any existing CQL 2 types mapping block
    removeCql2TypesMappingBlock(wsdd);
    // remove any introduce-added types mapping for CQL 2 types
    removeIntroduceManagedCql2TypesMappings(wsdd);
    // find the wsdd end tag, write mappings there
    int insertLocation = wsdd.indexOf(WSDD_END_TAG);
    if (insertLocation == -1) {
        LOG.error("Couldn't find " + WSDD_END_TAG + " in wsdd!");
        throw new IllegalStateException("Malformed wsdd found (" + wsddFile.getAbsolutePath() + ")");
    }
    String typesMappingText = getTypesFromCql2Wsdd();
    if (LOG.isDebugEnabled()) {
        LOG.debug("Adding types mapping text:\n");
        LOG.debug(typesMappingText);
    }
    wsdd.insert(insertLocation, typesMappingText);
    Utils.stringBufferToFile(wsdd, wsddFile);
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:25,代码来源:CQL2WsddTypesUtil.java

示例5: loadResource

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
protected static String loadResource(String resourceName) throws IOException {
    String resource = null;
    synchronized (resourceMap) {
        if (resourceMap.containsKey(resourceName)) {
            resource = resourceMap.get(resourceName);
        } else {
            InputStream stream = ClassUtils.getResourceAsStream(SDK40EncodingUtils.class, resourceName);
            if (stream != null) {
                StringBuffer buffer = Utils.inputStreamToStringBuffer(stream);
                resource = buffer.toString();
                resourceMap.put(resourceName, resource);
                stream.close();
            }
        }
    }
    return resource;
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:18,代码来源:SDK40EncodingUtils.java

示例6: loadResource

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
protected static String loadResource(String resourceName) throws IOException {
    String resource = null;
    synchronized (resourceMap) {
        if (resourceMap.containsKey(resourceName)) {
            resource = resourceMap.get(resourceName);
        } else {
            InputStream stream = ClassUtils.getResourceAsStream(
                SDK41EncodingUtils.class, resourceName);
            if (stream != null) {
                StringBuffer buffer = Utils.inputStreamToStringBuffer(stream);
                resource = buffer.toString();
                resourceMap.put(resourceName, resource);
                stream.close();
            }
        }
    }
    return resource;
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:19,代码来源:SDK41EncodingUtils.java

示例7: loadResource

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
protected static String loadResource(String resourceName) throws IOException {
    String resource = null;
    synchronized (resourceMap) {
        if (resourceMap.containsKey(resourceName)) {
            resource = resourceMap.get(resourceName);
        } else {
            InputStream stream = ClassUtils.getResourceAsStream(
                SDK43EncodingUtils.class, resourceName);
            if (stream != null) {
                StringBuffer buffer = Utils.inputStreamToStringBuffer(stream);
                resource = buffer.toString();
                resourceMap.put(resourceName, resource);
                stream.close();
            }
        }
    }
    return resource;
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:19,代码来源:SDK43EncodingUtils.java

示例8: modifyImpl

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
public static void modifyImpl(File sourceJava, File targetJava, String methodName) throws IOException {
    FileInputStream sourceInput = new FileInputStream(sourceJava);
    FileInputStream targetInput = new FileInputStream(targetJava);
    StringBuffer sourceContent = new StringBuffer(Utils.inputStreamToStringBuffer(sourceInput));
    StringBuffer targetContent = new StringBuffer(Utils.inputStreamToStringBuffer(targetInput));
    sourceInput.close();
    targetInput.close();

    int sourceStartOfMethod = startOfSignature(sourceContent, methodName);
    int sourceEndOfSignature = SyncHelper.endOfSignature(sourceContent, sourceStartOfMethod);
    int sourceEndOfImplementation = endOfMethod(sourceContent, sourceEndOfSignature);

    int targetStartOfMethod = startOfSignature(targetContent, methodName);
    int targetEndOfSignature = SyncHelper.endOfSignature(targetContent, targetStartOfMethod);
    int targetEndOfImplementation = endOfMethod(targetContent, targetEndOfSignature);

    targetContent.delete(targetEndOfSignature, targetEndOfImplementation);
    targetContent.insert(targetEndOfSignature, sourceContent.substring(sourceEndOfSignature,
        sourceEndOfImplementation));

    FileWriter out = new FileWriter(targetJava);
    out.write(targetContent.toString());
    out.flush();
    out.close();
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:26,代码来源:SourceUtils.java

示例9: main

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
/**
 * @param args
 */
public static void main(String[] args) {
    File base = new File("/Users/ervin/Projects/caGrid/caGrid-1_5_release/Software/core");
    try {
        List<File> classpaths = Utils.recursiveListFiles(base, new FileFilter() {
            
            @Override
            public boolean accept(File pathname) {
                return pathname.getName().equals(".classpath");
            }
        });
        for (File f : classpaths) {
            if (f.isFile()) {
                System.out.println("Editing " + f.getAbsolutePath());
                FileInputStream fis = new FileInputStream(f);
                StringBuffer buf = Utils.inputStreamToStringBuffer(fis);
                fis.close();
                String edited = buf.toString().replace("GT4_LOCATION", "GT4_SHA2_LOCATION");
                Utils.stringBufferToFile(new StringBuffer(edited), f);
            }
        }
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:28,代码来源:ClasspathFixer.java

示例10: getTestingResearchCenterInfo

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
private StringBuffer getTestingResearchCenterInfo() {
    InputStream metadataInput = getClass().getResourceAsStream("/researchCenter.xml");
    StringBuffer metadata = null;
    try {
        metadata = Utils.inputStreamToStringBuffer(metadataInput);
        metadataInput.close();
    } catch (IOException ex) {
        String message = "Error reading default research center metadata document: " + ex.getMessage();
        log.error(message, ex);
        fail(message);
    }
    return metadata;
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:14,代码来源:IndexServiceSystemTest.java

示例11: getTypesFromCql2Wsdd

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
private static String getTypesFromCql2Wsdd() throws IOException {
    LOG.debug("Reading CQL 2 types mapping from packaged wsdd");
    InputStream wsddStream = CQL2WsddTypesUtil.class.getResourceAsStream("/org/cagrid/cql2/mapping/client-config.wsdd");
    StringBuffer wsdd = Utils.inputStreamToStringBuffer(wsddStream);
    wsddStream.close();
    int start = wsdd.indexOf(START_MAPPING_COMMENT);
    int end = wsdd.indexOf(END_MAPPING_COMMENT, start) + END_MAPPING_COMMENT.length();
    return wsdd.substring(start, end);
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:10,代码来源:CQL2WsddTypesUtil.java

示例12: getInputSource

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
private InputSource getInputSource(String location) {
    InputSource source = null;
    URLConnection connection = getConnection(location);
    try {
        InputStream stream = connection.getInputStream();
        StringBuffer buffer = Utils.inputStreamToStringBuffer(stream);
        stream.close();
        source = new InputSource(new StringReader(buffer.toString()));
    } catch (Exception ex) {
        ex.printStackTrace();
        fail("Error creating input source for location " + location);
    }
    return source;
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:15,代码来源:PullWsdlStep.java

示例13: createIterator

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
/**
 * Serializes a List of serializable objects to a specified file on
 * the local disk, then creates an EnumIterator which can return
 * those objects.
 * 
 * @param objectIter
 *      An iterator to a collection of data objects to be enumerated
 * @param objectQName
 *      The QName of the objects
 * @param tempFilename
 *      The name of the file to serialize objects into.
 *      <b><i>NOTE:</b></i> For security reasons, access to this location 
 *      must be controlled in a production data environment.
 * @param wsddInput
 *      An input stream of the WSDD configuration file
 * @return
 *      An enum iterator instance to iterate the given objects
 * @throws Exception
 */
public static EnumIterator createIterator(Iterator objectIter, QName objectQName, InputStream wsddInput, String tempFilename) throws Exception {
    StringBuffer wsddContents = wsddInput != null ? Utils.inputStreamToStringBuffer(wsddInput) : null;
    writeOutObjects(objectIter, objectQName, tempFilename, wsddContents);
    return new ConcurrenPersistantObjectEnumIterator(
        new File(tempFilename), objectQName);
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:26,代码来源:ConcurrenPersistantObjectEnumIterator.java

示例14: createIterator

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
/**
 * Serializes a List of serializable objects to a specified file on
 * the local disk, then creates an EnumIterator which can return
 * those objects.
 * 
 * @param objects
 * 		The list of data objects to be enumerated
 * @param objectQName
 * 		The QName of the objects
 * @param filename
 * 		The name of the file to serialize objects into.
 * 		<b><i>NOTE:</b></i> For security reasons, access to this location 
 * 		must be controlled in a production data environment.
 * @param wsddInput
 * 		An input stream of the WSDD configuration 
 * @return
 * 		An enum iterator instance for the given objects
 * @throws Exception
 */
public static EnumIterator createIterator(List objects, QName objectQName, InputStream wsddInput, String filename) throws Exception {
	StringBuffer wsddContents = wsddInput != null ? Utils.inputStreamToStringBuffer(wsddInput) : null;
	writeOutObjects(objects.iterator(), objectQName, filename, wsddContents);
	return new SimplePersistantObjectIterator(new File(filename), objectQName);
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:25,代码来源:SimplePersistantObjectIterator.java

示例15: createIterator

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
/**
 * Serializes a List of serializable objects to a specified file on
 * the local disk, then creates an EnumIterator which can return
 * those objects.
 * 
 * @param objectIter
 * 		An iterator to a collection of data objects to be enumerated
 * @param objectQName
 * 		The QName of the objects
 * @param tempFilename
 * 		The name of the file to serialize objects into.
 * 		<b><i>NOTE:</b></i> For security reasons, access to this location 
 * 		must be controlled in a production data environment.
 * @param wsddInput
 * 		An input stream of the WSDD configuration file
 * @return
 * 		An enum iterator instance to iterate the given objects
 * @throws Exception
 */
public static EnumIterator createIterator(Iterator objectIter, QName objectQName, InputStream wsddInput, String tempFilename) throws Exception {
	StringBuffer wsddContents = wsddInput != null ? Utils.inputStreamToStringBuffer(wsddInput) : null;
	writeOutObjects(objectIter, objectQName, tempFilename, wsddContents);
	return new PersistantObjectIterator(new File(tempFilename), objectQName);
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:25,代码来源:PersistantObjectIterator.java


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