本文整理汇总了Java中java.io.ObjectOutput.writeUTF方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectOutput.writeUTF方法的具体用法?Java ObjectOutput.writeUTF怎么用?Java ObjectOutput.writeUTF使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.io.ObjectOutput
的用法示例。
在下文中一共展示了ObjectOutput.writeUTF方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writePrincipal
import java.io.ObjectOutput; //导入方法依赖的package包/类
public static void writePrincipal(GenericPrincipal p, ObjectOutput out) throws IOException {
out.writeUTF(p.getName());
out.writeBoolean(p.getPassword() != null);
if (p.getPassword() != null)
out.writeUTF(p.getPassword());
String[] roles = p.getRoles();
if (roles == null)
roles = new String[0];
out.writeInt(roles.length);
for (int i = 0; i < roles.length; i++)
out.writeUTF(roles[i]);
boolean hasUserPrincipal = (p != p.getUserPrincipal() && p.getUserPrincipal() instanceof Serializable);
out.writeBoolean(hasUserPrincipal);
if (hasUserPrincipal)
out.writeObject(p.getUserPrincipal());
}
示例2: writeExternal
import java.io.ObjectOutput; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void writeExternal( ObjectOutput out ) throws IOException
{
if ( upName == null )
{
String message = "Cannot serialize a NULL Dn";
LOG.error( message );
throw new IOException( message );
}
// Write the UPName
out.writeUTF( upName );
// Write the RDNs.
// First the number of RDNs
out.writeInt( size() );
// Loop on the RDNs
for ( Rdn rdn : rdns )
{
rdn.writeExternal( out );
}
out.flush();
}
示例3: writeExternal
import java.io.ObjectOutput; //导入方法依赖的package包/类
@Override
public void writeExternal(ObjectOutput out) throws IOException {
out.writeUTF((this.prefix != null) ? this.prefix : "");
out.writeUTF(this.localName);
// make sure m isn't null
getMethod();
out.writeUTF((this.owner != null) ?
this.owner :
this.m.getDeclaringClass().getName());
out.writeUTF((this.name != null) ?
this.name :
this.m.getName());
out.writeObject((this.types != null) ?
this.types :
ReflectionUtil.toTypeNameArray(this.m.getParameterTypes()));
}
示例4: writeExternal
import java.io.ObjectOutput; //导入方法依赖的package包/类
@Override
public void writeExternal(final ObjectOutput out) throws IOException {
// write kernelFunction
out.writeUTF(m_kernelFunction.getClass().getName());
m_kernelFunction.writeExternal(out);
// write trainingData
// rows
out.writeInt(m_rowCount);
// columns
out.writeInt(m_colCount);
// data
for (final double[] row : m_trainingData) {
for (final double col : row) {
out.writeDouble(col);
}
}
}
示例5: write
import java.io.ObjectOutput; //导入方法依赖的package包/类
/**
* Write endpoint to output stream.
*/
public void write(ObjectOutput out) throws IOException {
if (csf == null) {
out.writeByte(FORMAT_HOST_PORT);
out.writeUTF(host);
out.writeInt(port);
} else {
out.writeByte(FORMAT_HOST_PORT_FACTORY);
out.writeUTF(host);
out.writeInt(port);
out.writeObject(csf);
}
}
示例6: writeExternal
import java.io.ObjectOutput; //导入方法依赖的package包/类
@Override
public void writeExternal(final ObjectOutput arg0) throws IOException {
// call super method
super.writeExternal(arg0);
// write labels
arg0.writeInt(m_labels.length);
for (final String label : m_labels) {
arg0.writeUTF(label);
}
}
示例7: writeExternal
import java.io.ObjectOutput; //导入方法依赖的package包/类
/**
* This is the place where we serialize attributes, and all theirs
* elements.
*
* {@inheritDoc}
*/
@Override
public void writeExternal( ObjectOutput out ) throws IOException
{
// Write the UPId
out.writeUTF( upId );
// Write the ID
out.writeUTF( id );
// Write the HR flag, if not null
if ( isHR != null )
{
out.writeBoolean( true );
out.writeBoolean( isHR );
}
else
{
out.writeBoolean( false );
}
// Write the number of values
out.writeInt( size() );
if ( size() > 0 )
{
// Write each value
for ( Value value : values )
{
// Write the value
value.writeExternal( out );
}
}
out.flush();
}
示例8: writeExternal
import java.io.ObjectOutput; //导入方法依赖的package包/类
/**
* The object implements the writeExternal method to save its contents by
* calling the methods of DataOutput for its primitive values or calling the
* writeObject method of ObjectOutput for objects, strings and arrays.
*
* @throws IOException Includes any I/O exceptions that may occur
*/
public void writeExternal(ObjectOutput out) throws IOException {
String s = toString(); // contains ASCII chars only
// one-to-one correspondence between ASCII char and byte in UTF string
if (s.length() <= 65535) { // 65535 is max length of UTF string
out.writeUTF(s);
} else {
out.writeByte(0);
out.writeByte(0);
out.writeInt(s.length());
out.write(s.getBytes());
}
}
示例9: writeExternal
import java.io.ObjectOutput; //导入方法依赖的package包/类
@Override
public void writeExternal(ObjectOutput out) throws IOException {
out.writeUTF(this.expr);
out.writeUTF((this.expectedType != null) ? this.expectedType.getName()
: "");
out.writeObject(ReflectionUtil.toTypeNameArray(this.paramTypes));
out.writeObject(this.fnMapper);
out.writeObject(this.varMapper);
}
示例10: writeExternal
import java.io.ObjectOutput; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
out.writeInt(size);
out.writeInt(acsMode);
out.writeObject(uuid);
out.writeUTF(cache.getName());
}
示例11: writeExternal
import java.io.ObjectOutput; //导入方法依赖的package包/类
public void writeExternal(ObjectOutput out) throws IOException {
out.writeUTF(this.expr);
out.writeUTF((this.expectedType != null) ? this.expectedType.getName()
: "");
out.writeObject(ReflectionUtil.toTypeNameArray(this.paramTypes));
out.writeObject(this.fnMapper);
out.writeObject(this.varMapper);
}
示例12: writeExternal
import java.io.ObjectOutput; //导入方法依赖的package包/类
@Override
public void writeExternal(ObjectOutput out) throws IOException {
out.writeUTF(this.expr);
out.writeUTF((this.expectedType != null) ? this.expectedType.getName()
: "");
out.writeObject(ReflectionUtil.toTypeNameArray(this.paramTypes));
}
示例13: writeExternal
import java.io.ObjectOutput; //导入方法依赖的package包/类
/**
* Write out external representation for remote ref.
*/
public void writeExternal(ObjectOutput out) throws IOException
{
RemoteRef localRef = ref;
out.writeObject(id);
if (localRef == null) {
out.writeUTF("");
} else {
out.writeUTF(localRef.getRefClass(out));
localRef.writeExternal(out);
}
}
示例14: writeExternal
import java.io.ObjectOutput; //导入方法依赖的package包/类
@Override
public void writeExternal(ObjectOutput out) throws IOException {
out.writeUTF((this.prefix != null) ? this.prefix : "");
out.writeUTF(this.localName);
// make sure m isn't null
getMethod();
out.writeUTF((this.owner != null) ? this.owner : this.m.getDeclaringClass().getName());
out.writeUTF((this.name != null) ? this.name : this.m.getName());
out.writeObject(
(this.types != null) ? this.types : ReflectionUtil.toTypeNameArray(this.m.getParameterTypes()));
}
示例15: writeExternal
import java.io.ObjectOutput; //导入方法依赖的package包/类
@Override
public void writeExternal(ObjectOutput out) throws IOException {
out.writeUTF(this.mark);
out.writeObject(this.target);
}