muffinmanager/src/main/java/org/jbundle/util/muffinmanager/MuffinManager.java
public void setMuffin(String strParam, String strValue)
    {
        FileContents fc = null;
        URL url = null;
        try   {
            url = new URL(m_strCodeBase + strParam);
        } catch (Exception ex)  {
            return;
        }
        try   {
            fc = m_ps.get(url);
            fc.getMaxLength(); // This will throw an exception if there is no muffin yet.
        } catch (Exception ex)  {
            fc = null;
        }
        try   {
            if (fc == null)
            {
                m_ps.create(url, 100);
                fc = m_ps.get(url);
            }          // don't append
            if (strValue != null)
            {
                OutputStream os = fc.getOutputStream(false);
                byte[] buf = strValue.getBytes(ENCODING);
                os.write(buf);
                os.close();
                m_ps.setTag(url, PersistenceService.DIRTY);
            }
            else
                m_ps.delete(url);
        } catch (Exception ex)  {
            ex.printStackTrace(); // Return null for any exception
        }
    }
public void setMuffin(String strParam, String strValue)
    {
        FileContents fc = null;
        URL url = null;
        try   {
            url = new URL(m_strCodeBase + strParam);
        } catch (Exception ex)  {
            return;
        }
        try   {
            fc = m_ps.get(url);
            fc.getMaxLength(); // This will throw an exception if there is no muffin yet.
        } catch (Exception ex)  {
            fc = null;
        }
        try   {
            if (fc == null)
            {
                m_ps.create(url, 100);
                fc = m_ps.get(url);
            }          // don't append
            if (strValue != null)
            {
                OutputStream os = fc.getOutputStream(false);
                byte[] buf = strValue.getBytes(ENCODING);
                os.write(buf);
                os.close();
                m_ps.setTag(url, PersistenceService.DIRTY);
            }
            else
                m_ps.delete(url);
        } catch (Exception ex)  {
            ex.printStackTrace(); // Return null for any exception
        }
    }
public void setMuffin ( String strParam , String strValue ) { FileContents fc = null ; URL url = null ; try { url = new URL ( m_strCodeBase + strParam ) ; } catch ( Exception ex ) { return ; } try { fc = m_ps . get ( url ) ; fc . getMaxLength ( ) ; // This will throw an exception if there is no muffin yet. } catch ( Exception ex ) { fc = null ; } try { if ( fc == null ) { m_ps . create ( url , 100 ) ; fc = m_ps . get ( url ) ; } // don't append if ( strValue != null ) { OutputStream os = fc . getOutputStream ( false ) ; byte [ ] buf = strValue . getBytes ( ENCODING ) ; os . write ( buf ) ; os . close ( ) ; m_ps . setTag ( url , PersistenceService . DIRTY ) ; } else m_ps . delete ( url ) ; } catch ( Exception ex ) { ex . printStackTrace ( ) ; // Return null for any exception } }
Set the current value for this muffin.
@param strParam The key for this muffin parameter.
@param strValue The value for this muffin.
Set the current value for this muffin .