本文整理匯總了Java中goryachev.common.util.Rex類的典型用法代碼示例。如果您正苦於以下問題:Java Rex類的具體用法?Java Rex怎麽用?Java Rex使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Rex類屬於goryachev.common.util包,在下文中一共展示了Rex類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setBytes
import goryachev.common.util.Rex; //導入依賴的package包/類
protected final void setBytes(byte[] value)
{
if(value == null)
{
encrypted = null;
}
else
{
try
{
encrypted = MemCrypt.encrypt(value);
}
catch(Exception e)
{
// should not happen
throw new Rex(e);
}
}
}
示例2: getBytes
import goryachev.common.util.Rex; //導入依賴的package包/類
/**
* Returns decrypted byte array representing the stored object.
*/
public final byte[] getBytes()
{
if(encrypted == null)
{
return null;
}
else
{
try
{
byte[] b = MemCrypt.decrypt(encrypted);
return b;
}
catch(Exception e)
{
// should not happen
throw new Rex(e);
}
}
}
示例3: zero
import goryachev.common.util.Rex; //導入依賴的package包/類
public static void zero(CipherParameters p)
{
try
{
if(p != null)
{
if(p instanceof KeyParameter)
{
zero(((KeyParameter)p).getKey());
}
else if(p instanceof ParametersWithIV)
{
zero(((ParametersWithIV)p).getParameters());
}
else
{
// should not see this in production
throw new Rex("unknown " + p.getClass());
}
}
}
catch(Throwable e)
{
Log.ex(e);
}
}
示例4: attach
import goryachev.common.util.Rex; //導入依賴的package包/類
public void attach(JComponent c)
{
Object x = c.getClientProperty(KEY);
if(x == null)
{
c.putClientProperty(KEY, this);
}
else if(x instanceof ComponentSettings)
{
((ComponentSettings)x).append(this);
}
else
{
throw new Rex("unable to attach, " + x);
}
}
示例5: getValue
import goryachev.common.util.Rex; //導入依賴的package包/類
public Object getValue(Component c)
{
if(c instanceof JTextComponent)
{
return ((JTextComponent)c).getText();
}
if(c instanceof JCheckBox)
{
return ((JCheckBox)c).isSelected();
}
if(c instanceof JRadioButton)
{
return ((JRadioButton)c).isSelected();
}
else
{
throw new Rex("not supported: " + CKit.className(c));
}
}
示例6: monitor
import goryachev.common.util.Rex; //導入依賴的package包/類
/** each JTextComponent gets its own instance of CUndoManager */
public static void monitor(Object ... xs)
{
for(Object x: xs)
{
CUndoManager u = getUndoManager(x);
if(u == null)
{
if(x instanceof JTextComponent)
{
Document d = ((JTextComponent)x).getDocument();
d.addUndoableEditListener(new CUndoManager());
}
else if(x instanceof AbstractDocument)
{
((AbstractDocument)x).addUndoableEditListener(new CUndoManager());
}
else
{
throw new Rex("unable to attach undo manager to " + CKit.simpleName(x));
}
}
}
}
示例7: add
import goryachev.common.util.Rex; //導入依賴的package包/類
public void add(JComponent c)
{
if(c instanceof JTextComponent)
{
JTextComponent tc = (JTextComponent)c;
tc.getDocument().addDocumentListener(this);
tc.addPropertyChangeListener(PROPERTY_DOCUMENT, this);
}
else if(c instanceof ItemSelectable)
{
((ItemSelectable)c).addItemListener(this);
}
else
{
throw new Rex("ignored: " + c);
}
}
示例8: check
import goryachev.common.util.Rex; //導入依賴的package包/類
private void check()
{
SelectionSegment prev = null;
for(SelectionSegment s: segments)
{
if(prev != null)
{
if(!prev.isBefore(s))
{
throw new Rex("selection is not ordered " + this);
}
}
prev = s;
}
}
示例9: register
import goryachev.common.util.Rex; //導入依賴的package包/類
@Deprecated // switch to KRecord everywhere
public static synchronized void register(String id, Class<?> type, PersistenceHandler h)
{
// disallow disparate handlers
// ok to register the same handler twice
PrimitiveHandler old = handlers.get(type);
if(old != null)
{
if(old.getClass() != h.getClass())
{
throw new Rex("duplicate registration of type " + type);
}
}
old = handlers.get(id);
if(old != null)
{
if(id != ((PersistenceHandler)old).getTypeID())
{
throw new Rex("duplicate registration of type id " + id);
}
}
h.setTypeID(id);
handlers.put(type, h);
handlers.put(id, h);
}
示例10: createInputStream
import goryachev.common.util.Rex; //導入依賴的package包/類
private static final InputStream createInputStream(byte[] key, byte[] iv, InputStream is)
{
PaddedBufferedBlockCipher c = new PaddedBufferedBlockCipher(new CBCBlockCipher(new AESEngine()));
if(iv.length != c.getBlockSize())
{
throw new Rex("invalid block size");
}
CipherParameters p = new ParametersWithIV(new KeyParameter(key), iv);
return new XCipherInputStream(c, p, is);
}
示例11: createOutputStream
import goryachev.common.util.Rex; //導入依賴的package包/類
private static final OutputStream createOutputStream(byte[] key, byte[] iv, OutputStream os)
{
PaddedBufferedBlockCipher c = new PaddedBufferedBlockCipher(new CBCBlockCipher(new AESEngine()));
if(iv.length != c.getBlockSize())
{
throw new Rex("invalid block size");
}
CipherParameters p = new ParametersWithIV(new KeyParameter(key), iv);
return new XCipherOutputStream(c, p, os);
}
示例12: attach
import goryachev.common.util.Rex; //導入依賴的package包/類
private void attach(Component x)
{
JComponent c = getJComponent(x);
if(c == null)
{
throw new Rex("JFrame, JDialog, or JComponent");
}
c.putClientProperty(KEY, this);
}
示例13: add
import goryachev.common.util.Rex; //導入依賴的package包/類
public void add(Component c, String prop)
{
if(components.put(prop, c) != null)
{
throw new Rex("name already present: " + prop);
}
}
示例14: setLayout
import goryachev.common.util.Rex; //導入依賴的package包/類
public void setLayout(LayoutManager m)
{
if(m instanceof CTableLayout)
{
super.setLayout(m);
}
else
{
throw new Rex();
}
}
示例15: setAction
import goryachev.common.util.Rex; //導入依賴的package包/類
private static void setAction(Container comp, Action a, int condition, KeyStroke k)
{
if(k != null)
{
JComponent c;
if(comp instanceof JComponent)
{
c = (JComponent)comp;
}
else if(comp instanceof RootPaneContainer)
{
c = ((RootPaneContainer)comp).getRootPane();
}
else
{
throw new Rex();
}
if(a == null)
{
c.getInputMap(condition).remove(k);
}
else
{
c.getActionMap().put(a, a);
c.getInputMap(condition).put(k, a);
}
}
}