Structured Properties class

Hi!
I'm wondering if there is a class similar to the Properties class that outputs it content in a structured way. That is, if you use the Properties class to read properties from a properties file and then you modify its content and write it out to a file, there will not be the same structure in the output file as in the input file.
What I'm looking for is a class that can be used to parse properties files and where it is possible to change properties, but the output has the property names in the same place (in the file) as the input, but the property values might have changed.
Would really appreciate some help!
Best regards
Lars

there is no standard class for it. i think the best (and also an easy solution) is to do the input/output via a XML wrapper (written by yourself), with the available XML tools this is simple.
if you are going to use JDK1.4 have a look at the Preferences API: i think it is great!

Similar Messages

  • Properties class not available on remote stylesheet

    dreamweaver cc will not apply style classes if the  css is on remote server.  I have to download the style sheet in order for the classes to appear in the properties/class dropdown tool.  what happened to live view and how do I change this so it works with a remote css?

    That's how it works for me, too. 
    Just download the min.CSS file from the remote location and put it into your site folder.  With Bootstrap, I don't necessarily have to link to my local style sheet.  I can still reference the CDN version in my code.  But If I want to work with Bootstrap classes, etc... I have to have the CSS file in my site folder.
    Hope that helps.
    Nancy O.

  • Using properties class

    How do I extract keys with values of pcoa245 for example using the Properties() class. The file is shown below. Thanks for your help.
    pcoa245= C .. QMan_2 (tsorial@pcoa245)
    pcoa245= Q .. QMan_3 (tsorial@pcoa245)
    sun122= C .. Testing (tsorial@pcoa245)
    sun122= C .. testing ([email protected])
    sun122= R .. sasls01 (tsorial@LOCAL)

    Maybe it will help if I show you what I have so far:
    Properties p=new Properties();
    String sFile=FileOps.FileInDir(System.getProperty("user.dir"),"server_jobs.txt");
    p.load(new FileInputStream(sFile));
    //Add job item to server node
    jobItem=new DefaultMutableTreeNode(p.getProperty(zServer.getName()));
    serverName.add(jobItem);ServerName is a node within a JTree. I am trying to extract the lines (not just one) that start with pcoa245 and place the strings after the "=" into the tree. How would I extract these lines using the properties class.

  • How to reload Properties class

    Hi,
    I am using the following code to reload ResourceBundle.
    Now I have decided o switch from ResourceBundle to Properties.
    I would liek to know the modifications needed in this code to reload Properties class.
    When I use the same code I am getting NoSuchFieldException when the method 'getDeclaredField("cacheList")' is called.
    Class<Properties> type = Properties.class;
    Field cacheList = type.getDeclaredField("cacheList");
    cacheList.setAccessible(true);
    ((Map)cacheList.get(Properties.class)).clear();
    Please help.
    Thanks in advance,
    Neelambary

    Why don't you just use clear() and load(InputStream)?
    regards
    slowfly

  • Xcode, how do you take an app from an idea to a data model, data structure, or class structure?

    Hey everyone!
    I'm a beginner xcoder and computer engineering sophomore and have literally spent every hour of the past few weeks reading as much as I possibly can about becoming a developer.
    I've found plenty of documentation, and guides on how to do very specific things in xcode and objective-C but am still looking for more information on one topic; how do you decide which data models/structures/controllers etc to use?
    I mean, you personally. I've been looking for a resource on this and have not been able to find one. I just finished Apple's iOS Developers Guide and they mention "choosing a data model" but do not describe them in much detail.
    The following is what is provided in the guide:
    ● Choose a basic approach for your data model:
    ● Existing data model code—If you already have data model code written in a C-based language, you
    can integrate that code directly into your iOS apps. Because iOS apps are written in Objective-C, they
    work just fine with code written in other C-based languages. Of course, there is also benefit to writing
    an Objective-C wrapper for any non Objective-C code.
    ● Custom objects data model—A custom object typically combines some simple data (strings, numbers,
    dates, URLs, and so on) with the business logic needed to manage that data and ensure its consistency.
    Custom objects can store a combination of scalar values and pointers to other objects. For example,
    the Foundation framework defines classes for many simple data types and for storing collections of
    other objects. These classes make it much easier to define your own custom objects.
    ● Structured data model—If your data is highly structured—that is, it lends itself to storage in a
    database—use Core Data (or SQLite) to store the data. Core Data provides a simple object-oriented
    model for managing your structured data. It also provides built-in support for some advanced features
    like undo and iCloud. (SQLite files cannot be used in conjunction with iCloud.)
    ● Decide whether you need support for documents:
    The job of a document is to manage your app’s in-memory data model objects and coordinate the storage
    of that data in a corresponding file (or set of files) on disk. Documents normally connote files that the user
    created but apps can use documents to manage non user facing files too. One big advantage of using
    documents is that the UIDocument class makes interacting with iCloud and the local file system much
    simpler. For apps that use Core Data to store their content, the UIManagedDocument class provides similar
    support.
    I suppose my question boils down to, how do you decide which structures to use? If you can provide an example of an app idea and how its implemented that would be very helpful and much appreciated!
    For example, to implement the idea of an app which allows users to progress through levels of knowledge of a certain subject and rewarding them with badges and such (this is not an actual app just a whim) how would one model that?
    Thanks in advance for all your help!!!

    SgtChevelle wrote:
    how do you decide which structures to use?
    Trial and error.
    I wish I had a better answer for you, but that pretty much encapsulates it. There is some, but not much, good wisdom out there, but it takes a significant amount of experience to be able to recognize it. The software development community if currently afflicted with a case of copy-and-paste-itis. And the prognosis is poor.
    The solution is to be brutal to yourself and others. Focus on what you need and ignore everything else. Remember that other people have their own needs and methods and they might not be applicable to you. Apple, for example, can hire thousands of programmers, set them to coding for six months, pick the best results, and have the end-users spend their own time and monety to test it. If you don't have Apple's resources and power, think twice about adopting Apple's approach. And I am talking from a macro to a micro perspective. Apple's sample and boilerplate code is just junk. Don't assume you can't do better. You can.
    Unfortunately, all this takes time and practice. You can read popular books, but never assume that anyone knows more than you do. Maybe they do and maybe they don't. It takes time to figure that out. Just do your best, ignore the naysayers, and doubt other people even more than you doubt yourself.

  • How to use Common Structure in class!!

    Hi,
    I have 3 different structures being used in the 3 different methods containing one select query and populate the  internal table and exported now i want to use single method and pass the internal table depending on the structure which is receives
    Plz help me how i can achieve.
    Thanks...

    In the class this is how i have declared
    DATA_PACKAGE_STRUCTURE     Instance Attribute     Public     Type     /BIC/CS8E_HNOD     
    Method parameters       SELECT_METHOD                          
    Methods      Exception                                      
    Parameter               Type  Pas       Opt     Typing M     Associated Type
    DATA_PACKAGE            Import                Type          ANY                
    IT_AGRS                          Export               Type          ZTY_AGR_USERS      
    IT_AUTHMAP                   Export               Type          ZTY_ZAGR_AUTH      
    ABORT                             Export               Type         SY-SUBRC           
    i have declared DATA_PACKAGE with type ANY as per ur post let me know how will i create dynamic internal table and
    in attribute declare different structure such as /BIC/CS8E_HNDEL.
    Thanks...

  • Properties Class, How does it work

    Hi
    I was struggling to find how to use Properties Object, to read properties file, then I saw the following solution:
    fis = <classname>.getClass().getResourceAsStream("<prop file>"); (1)
    prop = new Properties();(2)
    prop.load(fis);(3)
    fis.close();(4)
    This works fine, but I am not able to understand, how does it work?
    <classname>.getClass() should return a class object, and this class must be havaing getResourceAsStream() method, which is used by the properties object. But what is the need of first getting a "class" object. Our aim is to open the Properties file, then why do we need any reference to the current class.
    Can anybody explain the jargon of the line -(1)
    Gaurav

    the Class class is defined in the lava.lang package. The java virtual machine (JVM) uses a class loader to load class definitions from wherever <g> into memory, ok? The Class class represents the JVM's internal holding of a class definition (as opposed to instances of the class itself).
    To get the Class for any class, you can use the getClass() method on any object, or you can use the <classname>.class syntax. Either way, you get an instance of Class.
    The Class class contains some utility methods about class definitions prresent in the JVM. Importantly, the Class object for a class contains a reference to the class loader that loaded the class. You get it with the getClassLoader() method. The class loader is a thing that knows how to get a class definition from a local drive, or of a jar file, or off the web (if you are using an applet), or whatever. If one class needs another class to work, the class loader knows how to get the definition for that other class.
    Say I have a class
    class Foo {
       int bar(Baz baz);
    }and another one
    class Baz {
    }And both of these are in a jar file at http://z.com/applet1.jar
    An instance of URLClassLoader will be used to fetch class Foo. When Foo needs the definition of Baz, that same loader will be used to get Baz.
    A jar file (or a directory on your local drive) can contain anything at all, not just .class files. It might contain .prioperties files. These are called "resources". If you bundle them up with your class files, then the class loader that loaded the class files can also get them. So if your widget has gif files that it uses for icons, you just bundle them all up together.
    Of course, Class.getResource() is just a convenience method for Class.getClassLoader().getResource().

  • Symbol Properties Class: field

    Hi,
    What exactly is the function of the Class field in the Symbol Properties window?

    I believe there are a couple of aspects to that, and for what I offer, anyone who knows better should chime in.
    If you have an object in the library that you want to load dynamically, such as a MovieClip, you prepare it for that by selecting the option to Export for Actionscript, which lights up the ability to define a Class name for the object.  When you compile the file a class definition for that object is automatically generated if there is not already a class by that name in a separate .as file.
    So you can create a movieclip and have it be its own class.  Or you can create some entity and assign it a Class ID that already exists as a separate .as file.
    And in your AS code, to create a new instance of that class, you do it just like any other AS3 class...
    var newInstance:ClassNameAssigned = new ClassNameAssigned();

  • Batch process for setting document (language) and page (structure) properties

    I'm looking for a batch process or script that will take a folder of PDFs and add some basic properties required by Section 508 (for accessibility) automagically--such as Document Properties where language=EnglishUS, and Page Properties Tab Order=Use Document Structure.
    I'm not a programmer so any help is very much appreciated.
    Thank you!
    Mary

    well on unix/Linux/solaris there are no drives but storage heirarchy starts with a root directory represented with ' / '. and all files and directories are created in root directoy like
    /usr/local/bin
    /export/home/san
    etc
    also filesystem of unix consists iNodes rathar than FAT entries as in case of Windows.
    some basic information is available at
    http://www.techonthenet.com/unix/index.php
    Regards

  • System Properties Class Loader, how to?

    Hi,
    I am trying to configure the WLS startup class to load some property class into system, i.e example.properties
    What does is it take?

    Hi,
    Step1). Create a Startup class like following:
    package startup;
    import java.util.*;
    import java.io.*;
    public class MyStartUp
        public static void main(String ar[]) throws Exception
               MyStartUp start=new MyStartUp();
                  Properties p=new Properties();
               InputStream stream=start.getClass().getClassLoader().getResourceAsStream("a.properties");
                     p.load(stream);
               System.out.println("\n\n\t Your City is : "+p.getProperty("city"));
    } Step2). Compile the above class like following
    javac  -d . MyStartUp.javaStep3). Now make a Jar which will include your properties file and the above Class
    jar -cvf  MyStartup.jar   startup  MyStartUp.java  a.propertiesStep4). Now put the MyStartUp.jar inside "$DOMAIN_HOME\lib" directory
    Step5). Configure the startup class from AdminConsole then restart your Server.
    Thanks
    Ravish Mody

  • Problem reading '\' character through Properties class

    Hi,
    I have to read a properties file which is like the following
    home=c:\java
    But when i read it back, it giving me like c:java. I know that '\' is a escape sequence char, cut how can I deal with it? Because my program requires to store paths in the java properties file and I can't store them as "c:\\java" so when I read it, I'll get back as "c:\java".
    I have done a sample code to explain my problem, please have a lot at it.
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.IOException;
    import java.util.Properties;
    public class BackSlashProblem {
         public static void main(String[] args) {
              Properties properties = new Properties();
              try {
                   properties.load(new FileInputStream(new File("." + File.separator + "myprops.properties")));
              } catch (FileNotFoundException e) {
                   e.printStackTrace();
              } catch (IOException e) {
                   e.printStackTrace();
              System.out.println(properties.getProperty("home")); // Here it's returning back as c:java, where as I want
                                                // it the way I stored it, i.e., c:\java. How can
                                                // I get it that way.
    }Thank you very much.
    Srikanth.

    Thank you all,
    I have to convert "\" as "\\" while storing cosI
    am
    not storing it using Properties.store() method.Is there any reason why you can't use it?Sorry for replying very very late. My internet
    connection was shortly disconnected and I couldn't
    reply back. My application does something very
    different than the sample program I sent. I sent the
    sample program to just recreate the problem outside
    of my application, and I sent to provide a workable
    code so that the other people in the forums can take
    a look at my problem and point out the mistake that I
    am doing.
    Anyways thank you all :D
    SrikanthBut that doesn't answer the question. Why can't you change your code so that you use store?
    Kaj

  • Structure pour classe évolutive (LV OOP)

    Bonjour,
    Quelle est la structure la plus adaptée pour gérer des classes qui sont susceptibles d'évoluer ? L'évolution consistera le plus souvent en un ajout de "variables membres". Je souhaiterais faire évoluer les classes tout en pouvant relire les objects sauvegardés dans la version précédente. Pour des raisons pratiques (grand nombre d'objets sauvegardés, sur des serveurs pas toujours accessibles),  j'aimerais ne pas avoir à "convertir" mes anciens fichiers dans le nouveau format.
    Comment construire ma classe initiale pour pouvoir dans le futur passer en version 2 tout en pouvant accéder à mon carnet d'adresse vieux de la version 1 ?
    Exemple :
    Classe version 1 : Demoiselle admet comme variable nom et numéro de téléphone
    Puis dans la version 2, j'ajoute à ces 2 variables un booléen "est-elle mariée ?"
    Espérant que la question est compréhensible.
    Merci !
    Résolu !
    Accéder à la solution.

     Bonjour petitOhu,
    Merci d'avoir posté sur le forum National Instruments.
    Je ne suis pas certain de bien comprendre ta question car il me semble que tu peux ajouter un élément dans la définition de ta classe (dans le *.ctl) sans pour autant "casser" les accesseurs ou propriétés/méthodes déjà existants.
    Finalement, il est aussi possible d'utiliser un serveur de contrôle de code source afin d'avoir un suivi de l'historique de ton développement. De plus, cela te permets de revenir à une version précédente facilement, de gérer le fait de développer à plusieurs... Voici un tutorial sur ce point.
    N’hésites pas à préciser ta question si je n’ai pas bien compris ce que tu cherche à faire.
    Benjamin R.
    R&D Software Development Manager
    http://www.fluigent.com/

  • Recommand std EHS substance structure, properties, characteristic ?

    Dear EHS experts,
    As a newby in EHS module, and before setup or specification database I am wondering about the best ways to setup our specification structure. As specification type, property tree, class, char. ... are the heart of the EHS database, I am wondering if I could setup these 4 types of object manually with Z object :
    I means by creating  :
    => ZREAL_SUB specification type,
    => ZCEHS_XXXX value assignement,
    => ZCEHS_XXXX class,
    => ZEHS_xxx characteristic,
    => ZEHS_xxx phrase Set, 
    Does this way of EHS customizing is dangeurous  ?
    Does some characteristics are very sensitive to any process ?
    Our EHS final scope will be : Safety Data, Dangeurous Goods checks, Waste Mgt, IHS.
    Thanks for your help.
    Regards,

    Hello all,
    With other SAP Module, I am used to setup Z sap object, in order to be able to compare (if necessary) my Z customizing object to the standard.
    Here, I am thinking the same way. For example, on the REAL_SUB, I would like to setup some custo point (for example the tabs that I will not used ...).  By customizing entirely the substance, I will be much more confident on how EHS works and how the substance is customized. It's also a good method for me to learn the way of customizing EHS.
    The other reason why I am thinking about this, is that I do not know how to use all the default characteristic assign to a class. Those characteristics do not "talk to me" ...   sometimes, even for end-user.
    So my idea, is to defined with end-user, the list of value assignment needed, and for each, all characteristic & data that could apply to it.  By bulding this all Value assignment-Charactiristic  tree, I will be probably much more confident with solution ...
    By Z naming convention, I was thinking of : Substance (like ZREAL_SUB), Z property tree, Z Value Assignent (property) with Z class assigned, in which I will setup Z characteristic.  I will not mix Z char with SAP_EHS class.
    For other point, I will keep std custo (for identifiers ID, regulation list, Rating/Valididty Area ...)
    Thanks for your recommandation.

  • Help me structure my classes oop way

    I have a combo box for color which takes it's items from a specific table from database. I don't want it to take items directly from db.
    I make a Color class which holds id and name, has public methods like getName, setName and save().
    I have also made 2 packages to divide GUI and other classes:
    GUI
    ---- window.java
    core
    --- Color.java
    So now I'm confused. Ofcourse there are lots of different ways but I'd like to know the oop way.
    Where do I write the code that gets all colors from database?
    I'll make a class that basically is a combobox?
    I'll make a new class called Colors that extends Color?

    That's a bit better. Depends on what they do.
    If Color is a class that sub-classes java.awt.Color
    (not sure why you would do that, and the description
    of it does not sound like it is or would be), then it
    might go in a package like com.colorapp.color.
    A class called Colors that is a "collection" of Color
    classes - if that's what it it, might go in a package
    perhaps like com.colorapp.utils.
    A class like MyColorCombo - if it's a widget, and why
    do you need to subclass one of those? - might go
    either in some main class package, or in something
    like com.colorapp.gui ...
    ~Billheh. Color was my bad. Dog would have been better.
    You made things clearer.
    I thought if ComboBoxDogs extended Dogs, and Dogs extended Dog then they had to make up something like this visually
    Dog
    --- Dogs
    --------ComboBoxDogs
    Like package dog, dog.dogs and dog.dogs.comboboxdogs .

  • Propblem with Properties class and .ini file !

    Hello I have to read and write in a .ini file. I've got no problem, using a bit of code like this
    Properties iniFile = new Properties();
    String result="exception";
    try{     
    iniFile.load(new FileInputStream(path));
    result = iniFile.getProperty("SrcPath","not found");     
    catch(IOException e){}
    finally{return result;}
    it works correctly, but my problem is that my .ini file contain path like "SrcPath = e:\directory1\directory2"
    And then in my result variable I get : "e:directory1directory2" all the slash are cutted by iniFile.load !!
    And the problem is that I can not put "\\" in my ini file because it is used by other programs that need just one slash !!!!
    Is anybody got an idea to get the right path "e:\directory1\directory2"
    Thanks by advance Eric

    1st question.
    Properties props = new Properties();
         try{
              String uploadprop = "c:/yourinifile.ini";
              File file = new File(uploadprop);
         FileInputStream fis = new FileInputStream(file);
              ByteArrayOutputStream baos = new ByteArrayOutputStream();
              int character;
              while((character=fis.read()) != -1){
              baos.write(character);
              if((char)character == '\\')
                   //write one more '\'
                   baos.write(character);
              ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
              baos.close();
              //load bais
              props.load(bais);
              bais.close();
              fis.close();
              System.out.println(props.getProperty("dirname"));
         }catch(Exception e){
    hope this helps
    rishi

Maybe you are looking for