本文整理了Java中jadex.xml.bean.JavaWriter.objectToByteArray()
方法的一些代码示例,展示了JavaWriter.objectToByteArray()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JavaWriter.objectToByteArray()
方法的具体详情如下:
包路径:jadex.xml.bean.JavaWriter
类名称:JavaWriter
方法名:objectToByteArray
[英]Convert to a byte array.
[中]转换为字节数组。
代码示例来源:origin: net.sourceforge.jadex/jadex-xml
/**
* Convert to a byte array.
*/
public static byte[] objectToByteArray(Object val, ClassLoader classloader)
{
return objectToByteArray(val, classloader, null);
}
代码示例来源:origin: net.sourceforge.jadex/jadex-platform-base
/**
* Encode an object.
* @param obj The object.
* @throws IOException
*/
// public byte[] encode(Object val, ClassLoader classloader)
public Object encode(Object val, ClassLoader classloader)
{
byte[] ret = JavaWriter.objectToByteArray(val, classloader);
if(DEBUG)
System.out.println("encode message: "+(new String(ret)));
return ret;
}
代码示例来源:origin: net.sourceforge.jadex/jadex-platform-extension-webservice-desktop
/**
* Get the size of the result.
*/
public long getSize(Object t, Class<?> type, Type genericType,
Annotation[] annotations, MediaType mediaType)
{
return JavaWriter.objectToByteArray(t, Thread.currentThread().getContextClassLoader()).length;
}
}
代码示例来源:origin: org.activecomponents.jadex/jadex-platform-extension-webservice-desktop-grizzly
/**
* Get the size of the result.
*/
public long getSize(Object t, Class<?> type, Type genericType,
Annotation[] annotations, MediaType mediaType)
{
return JavaWriter.objectToByteArray(t, Thread.currentThread().getContextClassLoader()).length;
}
}
代码示例来源:origin: net.sourceforge.jadex/jadex-platform
/**
* Encode an object.
* @param obj The object.
* @throws IOException
*/
// public byte[] encode(Object val, ClassLoader classloader)
public Object encode(Object val, ClassLoader classloader, IEncodingContext context)
{
byte[] ret = JavaWriter.objectToByteArray(val, classloader);
if(DEBUG)
System.out.println("encode message: "+(new String(ret, Charset.forName("UTF-8"))));
return ret;
}
代码示例来源:origin: net.sourceforge.jadex/jadex-platform-base
/**
* Encode data with the codec.
* @param val The value.
* @return The encoded object.
*/
public byte[] encode(Object val, ClassLoader classloader, Map<Class<?>, Object[]> info)
{
Object[] infos = info==null? null: info.get(getClass());
IObjectWriterHandler handler = (IObjectWriterHandler)(infos!=null? infos[1]: null);
byte[] ret = JavaWriter.objectToByteArray(val, classloader, handler);
if(DEBUG)
System.out.println("encode content: "+ret);
return ret;
}
代码示例来源:origin: net.sourceforge.jadex/jadex-platform
/**
* Encode data with the codec.
* @param val The value.
* @return The encoded object.
*/
public byte[] encode(Object val, ClassLoader classloader, Map<Class<?>, Object[]> info, IEncodingContext context)
{
Object[] infos = info==null? null: info.get(getClass());
IObjectWriterHandler handler = (IObjectWriterHandler)(infos!=null? infos[1]: null);
byte[] ret = JavaWriter.objectToByteArray(val, classloader, handler);
if(DEBUG)
System.out.println("encode content: "+new String(ret, Charset.forName("UTF-8")));
return ret;
}
代码示例来源:origin: org.activecomponents.jadex/jadex-platform
/**
* Encode an object.
* @param obj The object.
* @throws IOException
*/
// public byte[] encode(Object val, ClassLoader classloader)
public Object encode(Object val, ClassLoader classloader, IEncodingContext context)
{
byte[] ret = JavaWriter.objectToByteArray(val, classloader);
if(DEBUG)
{
try
{
System.out.println("encode message: "+(new String(ret, "UTF-8")));
}
catch(UnsupportedEncodingException e)
{
throw new RuntimeException(e);
}
}
return ret;
}
代码示例来源:origin: org.activecomponents.jadex/jadex-platform
/**
* Encode data with the codec.
* @param val The value.
* @return The encoded object.
*/
public byte[] encode(Object val, ClassLoader classloader, Map<Class<?>, Object[]> info, IEncodingContext context)
{
Object[] infos = info==null? null: info.get(getClass());
IObjectWriterHandler handler = (IObjectWriterHandler)(infos!=null? infos[1]: null);
byte[] ret = JavaWriter.objectToByteArray(val, classloader, handler);
if(DEBUG)
{
try
{
System.out.println("encode content: "+new String(ret, "UTF-8"));
}
catch(UnsupportedEncodingException e)
{
throw new RuntimeException(e);
}
}
return ret;
}
代码示例来源:origin: net.sourceforge.jadex/jadex-platform-base
byte[] cidbytes = JavaWriter.objectToByteArray(cid, AbstractRemoteCommand.class.getClassLoader());
for(int runs=0; runs<3; runs++)
内容来源于网络,如有侵权,请联系作者删除!