congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Properties
Code IndexAdd Tabnine to your IDE (free)

How to use
Properties
in
org.kie.commons.java.nio.base

Best Java code snippets using org.kie.commons.java.nio.base.Properties (Showing top 13 results out of 315)

origin: org.kie.commons/kie-nio2-model

public void load( final InputStream in ) {
  load( in, true );
}
origin: org.kie.commons/kie-nio2-model

public Properties( final Map<String, Object> original ) {
  putAll( original );
}
origin: org.kie.commons/kie-nio2-model

@Override
public void loadContent( final Properties properties ) {
  content.clear();
  for ( final Map.Entry<String, Object> attr : properties.entrySet() ) {
    content.put( attr.getKey(), attr.getValue() );
  }
}
origin: org.kie.commons/kie-commons-io

protected void loadDotFile( final Path path ) {
  final Properties content = new Properties();
  content.load( newInputStream( dot( path ) ) );
  if ( path instanceof AttrHolder ) {
    ( (AttrHolder) path ).getAttrStorage().loadContent( content );
  }
}
origin: org.kie.commons/kie-commons-io

@Override
public Map<String, Object> readAttributes( final Path path,
                      final String attributes )
    throws UnsupportedOperationException, NoSuchFileException, IllegalArgumentException,
    IOException, SecurityException {
  checkNotNull( "path", path );
  checkNotEmpty( "attributes", attributes );
  final Properties original = new Properties( Files.readAttributes( path, attributes ) );
  if ( attributes.equals( "*" ) && exists( dot( path ) ) ) {
    boolean isAttrHolder = path instanceof AttrHolder;
    if ( isAttrHolder && ( (AttrHolder) path ).getAttrStorage().getContent().size() > 0 ) {
      return ( (AttrHolder) path ).getAttrStorage().getAllContent();
    }
    final Properties content = new Properties();
    content.load( newInputStream( dot( path ) ) );
    content.putAll( original );
    if ( isAttrHolder ) {
      ( (AttrHolder) path ).getAttrStorage().loadContent( content );
    }
    return content;
  }
  return original;
}
origin: org.kie.commons/kie-nio2-model

public void load( final InputStream in,
         boolean closeOnFinish ) {
  final XStream xstream = new XStream();
  final Properties temp = new Properties();
  try {
    xstream.fromXML( in, temp );
  } catch ( final XStreamException ex ) {
    if ( !ex.getMessage().equals( " : input contained no data" ) ) {
      throw ex;
    }
  }
  for ( final Map.Entry<String, Object> entry : temp.entrySet() ) {
    if ( entry.getValue() != null ) {
      put( entry.getKey(), entry.getValue() );
    }
  }
  temp.clear();
  if ( closeOnFinish ) {
    try {
      in.close();
    } catch ( IOException e ) {
    }
  }
}
origin: org.kie.commons/kie-nio2-model

public static void buildDotFile( final Path path,
                 final OutputStream out,
                 final FileAttribute<?>... attrs ) {
  if ( attrs != null && attrs.length > 0 ) {
    final Properties properties = new Properties();
    for ( final FileAttribute<?> attr : attrs ) {
      if ( attr.value() instanceof Serializable ) {
        properties.put( attr.name(), attr.value() );
      }
    }
    try {
      properties.store( out );
    } catch ( final Exception e ) {
      throw new IOException( e );
    }
    if ( path instanceof AttrHolder ) {
      ( (AttrHolder) path ).getAttrStorage().loadContent( properties );
    }
  } else {
    path.getFileSystem().provider().deleteIfExists( dot( path ) );
  }
}
origin: org.kie.commons/kie-nio2-model

  private synchronized Properties buildProperties( boolean includesNonSerializable ) {
    final Properties properties = new Properties( content );

    for ( final Map.Entry<String, AttributeView> view : viewsNameIndex.entrySet() ) {
      if ( includesNonSerializable ||
          view.getValue() instanceof ExtendedAttributeView && ( (ExtendedAttributeView) view.getValue() ).isSerializable() ) {
        final ExtendedAttributeView extendedView = (ExtendedAttributeView) view.getValue();
        for ( final Map.Entry<String, Object> attr : extendedView.readAllAttributes().entrySet() ) {
          properties.put( attr.getKey(), attr.getValue() );
        }
      }
    }

    return properties;
  }
}
origin: org.kie.commons/kie-nio2-model

public void store( final OutputStream out ) {
  store( out, true );
}
origin: org.kie.commons/kie-nio2-model

public Object put( final String key,
          final Object value ) {
  if ( value == null ) {
    return remove( key );
  }
  return super.put( key, value );
}
origin: org.kie.commons/kie-nio2-model

@Override
public void clear() {
  viewsNameIndex.clear();
  viewsTypeIndex.clear();
  content.clear();
}
origin: org.kie.commons/kie-commons-io

protected synchronized Path internalCreateDirectory( final Path dir,
                           final boolean skipAlreadyExistsException,
                           final FileAttribute<?>... attrs )
    throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException,
    IOException, SecurityException {
  checkNotNull( "dir", dir );
  FileAttribute<?>[] allAttrs = attrs;
  try {
    Files.createDirectory( dir, attrs );
  } catch ( final FileAlreadyExistsException ex ) {
    final Properties properties = new Properties();
    if ( exists( dot( dir ) ) ) {
      properties.load( newInputStream( dot( dir ) ) );
    }
    allAttrs = consolidate( properties, attrs );
    if ( !skipAlreadyExistsException ) {
      throw ex;
    }
  }
  buildDotFile( dir, newOutputStream( dot( dir ) ), allAttrs );
  return dir;
}
origin: org.kie.commons/kie-commons-io

@Override
public synchronized SeekableByteChannel newByteChannel( final Path path,
                            final Set<? extends OpenOption> options,
                            final FileAttribute<?>... attrs )
    throws IllegalArgumentException, UnsupportedOperationException,
    FileAlreadyExistsException, IOException, SecurityException {
  checkNotNull( "path", path );
  final Properties properties = new Properties();
  if ( exists( dot( path ) ) ) {
    properties.load( newInputStream( dot( path ) ) );
  }
  final FileAttribute<?>[] allAttrs = consolidate( properties, attrs );
  final SeekableByteChannel result = Files.newByteChannel( path, buildOptions( options ), allAttrs );
  if ( isFileScheme( path ) ) {
    buildDotFile( path, newOutputStream( dot( path ) ), allAttrs );
  }
  return result;
}
org.kie.commons.java.nio.baseProperties

Most used methods

  • <init>
  • load
  • putAll
  • clear
  • entrySet
  • put
  • remove
  • store

Popular in Java

  • Making http requests using okhttp
  • requestLocationUpdates (LocationManager)
  • setScale (BigDecimal)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • Menu (java.awt)
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • JFileChooser (javax.swing)
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now