本文整理汇总了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);
}
}
}