/** * Remove message codec type. * @param codec The codec type. */ public IFuture<Void> removeMessageCodec(Class codec) { codecfactory.removeCodec(codec); return IFuture.DONE; }
/** * Encode an object. * @param obj The object. * @throws IOException */ public Object encode(Object val, ClassLoader classloader, IEncodingContext context) { return encodeBytes((byte[])val, classloader); }
/** * Get array of message codecs for codec ids. */ public ICodec[] getMessageCodecs(byte[] codecids) { ICodec[] codecs = new ICodec[codecids.length]; for(int i=0; i<codecs.length; i++) { codecs[i] = codecfactory.getCodec(codecids[i]); } return codecs; }
/** * Get the default codecs. * @return The default codecs. */ public ICodec[] getDefaultCodecs() { if(default_codecs==null) { synchronized(this) { if(default_codecs==null) { byte[] defids = getDefaultCodecIds(); default_codecs = new ICodec[defids.length]; for(int i=0; i<defids.length; i++) { default_codecs[i] = getCodec(defids[i]); } } } } return default_codecs; }
/** * Get the codec ids. * @return The codec ids. */ protected byte[] getCodecIds() { return ms.getCodecFactory().getDefaultCodecIds(); }
/** * Decode an object. * @return The decoded object. * @throws IOException */ public Object decode(Object bytes, ClassLoader classloader, IErrorReporter rep) { return decodeBytes(bytes instanceof byte[] ? new ByteArrayInputStream((byte[])bytes) : (ByteArrayInputStream)bytes, classloader); }
/** * Get the default codec ids. */ protected static byte[] getIds(Class[] default_codecs) { byte[] ret = new byte[default_codecs.length]; for(int i=0; i<ret.length; i++) { ret[i] = getCodecId(default_codecs[i]); } return ret; }
/** * Add message codec type. * @param codec The codec type. */ public IFuture<Void> addMessageCodec(Class codec) { codecfactory.addCodec(codec); return IFuture.DONE; }
/** * Get the default codecs. * @return The default codecs. */ public ICodec[] getDefaultCodecs() { if(default_codecs==null) { synchronized(this) { if(default_codecs==null) { byte[] defids = getDefaultCodecIds(); default_codecs = new ICodec[defids.length]; for(int i=0; i<defids.length; i++) { default_codecs[i] = getCodec(defids[i]); } } } } return default_codecs; }
/** * Get the codec ids. * @return The codec ids. */ protected byte[] getCodecIds() { return ms.getCodecFactory().getDefaultCodecIds(); }
/** * Decode bytes. * @return The decoded bytes. * @throws IOException */ public static byte[] decodeBytes(byte[] bytes, ClassLoader classloader) { return decodeBytes(new ByteArrayInputStream(bytes), classloader); }
/** * Remove message codec type. * @param codec The codec type. */ public IFuture<Void> removeMessageCodec(Class codec) { codecfactory.removeCodec(codec); return new Future(null); }
/** * Encode an object. * @param obj The object. * @throws IOException */ public Object encode(Object val, ClassLoader classloader, IEncodingContext context) { return encodeBytes((byte[])val, classloader); }
/** * Get array of message codecs for codec ids. */ public ICodec[] getMessageCodecs(byte[] codecids) { ICodec[] codecs = new ICodec[codecids.length]; for(int i=0; i<codecs.length; i++) { codecs[i] = codecfactory.getCodec(codecids[i]); } return codecs; }
/** * Get the default codec ids. */ protected static byte[] getIds(Class[] default_codecs) { byte[] ret = new byte[default_codecs.length]; for(int i=0; i<ret.length; i++) { ret[i] = getCodecId(default_codecs[i]); } return ret; }
/** * Add message codec type. * @param codec The codec type. */ public IFuture<Void> addMessageCodec(Class codec) { codecfactory.addCodec(codec); return new Future(null); }
/** * Get the codecs. * @return The codecs. */ protected ICodec[] getCodecs() { return ms.getMessageCodecs(ms.getCodecFactory().getDefaultCodecIds()); }
/** * Decode bytes. * @return The decoded bytes. * @throws IOException */ public static byte[] decodeBytes(byte[] bytes, ClassLoader classloader) { return decodeBytes(new ByteArrayInputStream(bytes), classloader); }
/** * Get the codecs. * @return The codecs. */ protected ICodec[] getCodecs() { return ms.getMessageCodecs(ms.getCodecFactory().getDefaultCodecIds()); }
/** * Decode an object. * @return The decoded object. * @throws IOException */ public Object decode(Object bytes, ClassLoader classloader, IErrorReporter rep) { return decodeBytes(bytes instanceof byte[] ? new ByteArrayInputStream((byte[])bytes) : (ByteArrayInputStream)bytes, classloader); }