Package java.util.prefs

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


    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

        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

        Preferences testNode = prefs.node( "testNode" );

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

        testNode.sync();

        testNode.putBoolean( "boolKey", true );

        testNode.putByteArray( "arrayKey", new byte[10] );
View Full Code Here

        testNode.putInt( "intKey", 345 );

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

        testNode.sync();

        testNode = prefs.node( "testNode" );

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

        Preferences testNode = prefs.node( "testNode" );

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

        testNode.sync();

        testNode.putBoolean( "boolKey", true );

        testNode.putByteArray( "arrayKey", new byte[10] );
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.