Package java.util.prefs

Examples of java.util.prefs.Preferences.sync()


        testNode.putInt( "intKey", 345 );

        testNode.putLong( "longKey", 75449559185447L );

        testNode.sync();

        testNode = prefs.node( "testNode" );

        assertEquals( true, testNode.getBoolean( "boolKey", false ) );
View Full Code Here


        assertEquals( "no value", testNode.get( "doubleKey", "no value" ) );

        assertEquals( "no value", testNode.get( "arrayKey", "no value" ) );

        testNode.sync();

        assertEquals( "no value", testNode.get( "doubleKey", "no value" ) );

        assertEquals( "no value", testNode.get( "arrayKey", "no value" ) );
    }
View Full Code Here

    public void testCreate() throws BackingStoreException
    {
        Preferences testNode = prefs.node( "testNode" );

        testNode.put( "testNodeKey", "testNodeValue" );
        testNode.sync();
    }


    /**
     * Tests the creation and use of a new preferences node.
View Full Code Here

    public void testCreateAndSet() throws BackingStoreException
    {
        Preferences testNode = prefs.node( "testNode" );

        testNode.put( "testNodeKey", "testNodeValue" );
        testNode.sync();

        testNode.putBoolean( "boolKey", true );
        testNode.putByteArray( "arrayKey", new byte[10] );
        testNode.putDouble( "doubleKey", 3.14 );
        testNode.putFloat( "floatKey", ( float ) 3.14 );
View Full Code Here

        testNode.putByteArray( "arrayKey", new byte[10] );
        testNode.putDouble( "doubleKey", 3.14 );
        testNode.putFloat( "floatKey", ( float ) 3.14 );
        testNode.putInt( "intKey", 345 );
        testNode.putLong( "longKey", 75449559185447L );
        testNode.sync();

        testNode = prefs.node( "testNode" );

        assertEquals( true, testNode.getBoolean( "boolKey", false ) );
        assertTrue( 3.14 == testNode.getDouble( "doubleKey", 9.20 ) );
View Full Code Here

    public void testCreateAndRemove() throws BackingStoreException
    {
        Preferences testNode = prefs.node( "testNode" );

        testNode.put( "testNodeKey", "testNodeValue" );
        testNode.sync();

        testNode.putBoolean( "boolKey", true );
        testNode.putByteArray( "arrayKey", new byte[10] );
        testNode.putDouble( "doubleKey", 3.14 );
        testNode.putFloat( "floatKey", ( float ) 3.14 );
View Full Code Here

        testNode.putByteArray( "arrayKey", new byte[10] );
        testNode.putDouble( "doubleKey", 3.14 );
        testNode.putFloat( "floatKey", ( float ) 3.14 );
        testNode.putInt( "intKey", 345 );
        testNode.putLong( "longKey", 75449559185447L );
        testNode.sync();

        testNode = prefs.node( "testNode" );

        assertEquals( true, testNode.getBoolean( "boolKey", false ) );
        assertTrue( 3.14 == testNode.getDouble( "doubleKey", 9.20 ) );
View Full Code Here

        testNode.remove( "arrayKey" );

        assertEquals( "no value", testNode.get( "doubleKey", "no value" ) );
        assertEquals( "no value", testNode.get( "arrayKey", "no value" ) );

        testNode.sync();

        assertEquals( "no value", testNode.get( "doubleKey", "no value" ) );
        assertEquals( "no value", testNode.get( "arrayKey", "no value" ) );
    }
}
View Full Code Here

            // want to export such data in the preferences.
        }

        // Ensure the data is properly written into preferences before
        // continuing.
        prefs.sync();
    }

    /**
     * Get an integer from the settings.
     * <p>
 
View Full Code Here

                final String rval = node.get("system.id", "UNAVAILABLE");
                if("UNAVAILABLE".equals(rval)) {
                    String newid = UUID.randomUUID().toString();
                    node.put("system.id", newid);
                    node.sync();
                    return newid;
                }
                return rval;
            } catch(Exception e) {
                Options.$(this.commonCore, options).failure(null, e, "uniqueid:create", "Error getting the ID " + id.getClass() + " (on Lion this might be a bug).");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.