Codota Logo
IOUtils.toString
Code IndexAdd Codota to your IDE (free)

How to use
toString
method
in
org.drools.repository.utils.IOUtils

Best Java code snippets using org.drools.repository.utils.IOUtils.toString (Showing top 2 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
BufferedReader b =
  • Codota IconInputStream in;new BufferedReader(new InputStreamReader(in))
  • Codota IconReader in;new BufferedReader(in)
  • Codota IconFile file;new BufferedReader(new FileReader(file))
  • Smart code suggestions by Codota
}
origin: org.drools/guvnor-repository

/**
 * Only for use in the StorageEventManager, for passing the fromRepo
 * parameter
 * 
 * returns the string contents of the asset node. If this is a binary asset,
 * this will return null (use getBinaryContent instead).
 */    
//REVISIT: This return the binary data as a byte array if its binary asset. 
//Return null is better?
public String getContent(Boolean fromRepo) throws RulesRepositoryException {
  try {
    if ( StorageEventManager.hasLoadEvent() && !fromRepo ) {
      return IOUtils.toString( StorageEventManager.getLoadEvent().loadContent( this ) );
    }
    if ( isBinary() ) {
      return new String( this.getBinaryContentAsBytes() );
    }
    Node ruleNode = getVersionContentNode();
    if ( ruleNode.hasProperty( CONTENT_PROPERTY_NAME ) ) {
      Property data = ruleNode.getProperty( CONTENT_PROPERTY_NAME );
      return data.getValue().getString();
    } else {
      return "";
    }
  } catch ( Exception e ) {
    log.error( "Caught Exception",
          e );
    throw new RulesRepositoryException( e );
  }
}
origin: org.chtijbug.drools/guvnor-repository

/**
 * Only for use in the StorageEventManager, for passing the fromRepo
 * parameter
 * 
 * returns the string contents of the asset node. If this is a binary asset,
 * this will return null (use getBinaryContent instead).
 */    
//REVISIT: This return the binary data as a byte array if its binary asset. 
//Return null is better?
public String getContent(Boolean fromRepo) throws RulesRepositoryException {
  try {
    if ( StorageEventManager.hasLoadEvent() && !fromRepo ) {
      return IOUtils.toString( StorageEventManager.getLoadEvent().loadContent( this ) );
    }
    if ( isBinary() ) {
      return new String( this.getBinaryContentAsBytes() );
    }
    Node ruleNode = getVersionContentNode();
    if ( ruleNode.hasProperty( CONTENT_PROPERTY_NAME ) ) {
      Property data = ruleNode.getProperty( CONTENT_PROPERTY_NAME );
      return data.getValue().getString();
    } else {
      return "";
    }
  } catch ( Exception e ) {
    log.error( "Caught Exception",
          e );
    throw new RulesRepositoryException( e );
  }
}
org.drools.repository.utilsIOUtilstoString

Javadoc

Get the contents of an InputStream as a String using the default character encoding of the platform.

This method buffers the input internally, so there is no need to use a BufferedInputStream.

Popular methods of IOUtils

  • copy
    Copy chars from a Reader to a Writer. This method buffers the input internally, so there is no need
  • copyLarge
    Copy chars from a large (over 2GB) Reader to a Writer. This method buffers the input internally, so
  • readLines
    Get the contents of a Reader as a list of Strings, one entry per line. This method buffers the input
  • toByteArray
    Get the contents of a String as a byte[] using the default character encoding of the platform. This
  • write
    Writes chars from a char[] to a Writer using the default character encoding of the platform.
  • writeLines
    Writes the toString() value of each item in a collection to a Writer line by line, using the specifi

Popular in Java

  • Updating database using SQL prepared statement
  • setContentView (Activity)
  • getContentResolver (Context)
  • orElseThrow (Optional)
  • Color (java.awt)
    The Color class is used encapsulate colors in the default sRGB color space or colors in arbitrary co
  • URI (java.net)
    Represents a Uniform Resource Identifier (URI) reference. Aside from some minor deviations noted bel
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • Reference (javax.naming)
  • JTable (javax.swing)
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now