当前位置: 首页>>代码示例>>Java>>正文


Java ObjectInput.readFully方法代码示例

本文整理汇总了Java中java.io.ObjectInput.readFully方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectInput.readFully方法的具体用法?Java ObjectInput.readFully怎么用?Java ObjectInput.readFully使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.io.ObjectInput的用法示例。


在下文中一共展示了ObjectInput.readFully方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readSafely

import java.io.ObjectInput; //导入方法依赖的package包/类
/** Reads an object from the given object input.
* The object had to be saved by the {@link NbObjectOutputStream#writeSafely} method.
*
* @param oi object input
* @return the read object
* @exception IOException if IO error occured
* @exception SafeException if the operation failed but the stream is ok
*    for further reading
*/
public static Object readSafely(ObjectInput oi) throws IOException {
    int size = oi.readInt();
    byte[] byteArray = new byte[size];
    oi.readFully(byteArray, 0, size);

    try {
        ByteArrayInputStream bis = new ByteArrayInputStream(byteArray);
        NbObjectInputStream ois = new NbObjectInputStream(bis);
        Object obj = ois.readObject();
        bis.close();

        return obj;
    } catch (Exception exc) {
        // encapsulate all exceptions into safe exception
        throw new SafeException(exc);
    } catch (LinkageError le) {
        throw new SafeException(new InvocationTargetException(le));
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:29,代码来源:NbObjectInputStream.java

示例2: readExternal

import java.io.ObjectInput; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void readExternal( ObjectInput in ) throws IOException, ClassNotFoundException
{
    oid = in.readUTF();
    criticality = in.readBoolean();

    if ( in.readBoolean() )
    {
        int valueLength = in.readInt();

        if ( valueLength > 0 )
        {
            value = new byte[valueLength];
            in.readFully( value );
        }
    }
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:21,代码来源:LdifControl.java

示例3: readMembers

import java.io.ObjectInput; //导入方法依赖的package包/类
/**
 * @deprecated  Unused - will be removed in 8.0.x
 */
@Deprecated
protected Member[] readMembers(ObjectInput in) throws IOException {
    int nodecount = in.readInt();
    Member[] members = new Member[nodecount];
    for ( int i=0; i<members.length; i++ ) {
        byte[] d = new byte[in.readInt()];
        in.readFully(d);
        if (d.length > 0) members[i] = MemberImpl.getMember(d);
    }
    return members;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:15,代码来源:AbstractReplicatedMap.java

示例4: readExternal

import java.io.ObjectInput; //导入方法依赖的package包/类
/**
 * @see java.io.Externalizable#readExternal
 * @param in ObjectInput
 * @throws IOException
 */
@Override
public void readExternal(ObjectInput in ) throws IOException {
    int length = in.readInt();
    message = new byte[length];
    in.readFully(message);
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:12,代码来源:ByteMessage.java

示例5: readExternal

import java.io.ObjectInput; //导入方法依赖的package包/类
@Override
public void readExternal(ObjectInput in) throws IOException,ClassNotFoundException {
    reply = in.readBoolean();
    int length = in.readInt();
    uuid = new byte[length];
    in.readFully(uuid);
    length = in.readInt();
    rpcId = new byte[length];
    in.readFully(rpcId);
    message = (Serializable)in.readObject();
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:12,代码来源:RpcMessage.java

示例6: readExternal

import java.io.ObjectInput; //导入方法依赖的package包/类
@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    int length = in.readInt();
    byte[] message = new byte[length];
    in.readFully(message);
    getMember(message,this);

}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:9,代码来源:MemberImpl.java

示例7: readExternal

import java.io.ObjectInput; //导入方法依赖的package包/类
@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  final int len = in.readInt();
  final byte[] bytes = new byte[len];
  in.readFully(bytes);
  readFromStream(new ByteArrayInputStream(bytes));
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:8,代码来源:LoopedAbstractDrillSerializable.java

示例8: readExternal

import java.io.ObjectInput; //导入方法依赖的package包/类
@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
	reply = true;
	int length = in.readInt();
	uuid = new byte[length];
	in.readFully(uuid);
	length = in.readInt();
	rpcId = new byte[length];
	in.readFully(rpcId);
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:11,代码来源:RpcMessage.java

示例9: readMembers

import java.io.ObjectInput; //导入方法依赖的package包/类
/**
 * @deprecated Unused - will be removed in 8.0.x
 */
@Deprecated
protected Member[] readMembers(ObjectInput in) throws IOException {
	int nodecount = in.readInt();
	Member[] members = new Member[nodecount];
	for (int i = 0; i < members.length; i++) {
		byte[] d = new byte[in.readInt()];
		in.readFully(d);
		if (d.length > 0)
			members[i] = MemberImpl.getMember(d);
	}
	return members;
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:16,代码来源:AbstractReplicatedMap.java

示例10: readExternal

import java.io.ObjectInput; //导入方法依赖的package包/类
@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
	int length = in.readInt();
	byte[] message = new byte[length];
	in.readFully(message);
	getMember(message, this);

}
 
开发者ID:how2j,项目名称:lazycat,代码行数:9,代码来源:MemberImpl.java

示例11: readExternal

import java.io.ObjectInput; //导入方法依赖的package包/类
/**
     * The object implements the readExternal method to restore its
     * contents by calling the methods of DataInput for primitive
     * types and readObject for objects, strings and arrays.  The
     * readExternal method must read the values in the same sequence
     * and with the same types as were written by writeExternal.
     * @exception ClassNotFoundException If the class for an object being
     *              restored cannot be found.
     */
    public void readExternal(ObjectInput in) throws IOException,
ClassNotFoundException {
        String s = in.readUTF();
        if (s == null || s.length() == 0) { // long mime type
            byte[] ba = new byte[in.readInt()];
            in.readFully(ba);
            s = new String(ba);
        }
        try {
            parse(s);
        } catch(MimeTypeParseException e) {
            throw new IOException(e.toString());
        }
    }
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:24,代码来源:MimeType.java

示例12: readExternal

import java.io.ObjectInput; //导入方法依赖的package包/类
/**
     * The object implements the readExternal method to restore its contents by
     * calling the methods of DataInput for primitive types and readObject for
     * objects, strings and arrays. The readExternal method must read the values
     * in the same sequence and with the same types as were written by
     * writeExternal.
     *
     * @throws ClassNotFoundException If the class for an object being restored
     *         cannot be found
     */
    public void readExternal(ObjectInput in) throws IOException,
ClassNotFoundException {
        String s = in.readUTF();
        if (s == null || s.length() == 0) { // long mime type
            byte[] ba = new byte[in.readInt()];
            in.readFully(ba);
            s = new String(ba);
        }
        try {
            parse(s);
        } catch(MimeTypeParseException e) {
            throw new IOException(e.toString());
        }
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:MimeType.java

示例13: readExternal

import java.io.ObjectInput; //导入方法依赖的package包/类
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  offset = Platform.BYTE_ARRAY_OFFSET;
  numBytes = in.readInt();
  base = new byte[numBytes];
  in.readFully((byte[]) base);
}
 
开发者ID:huang-up,项目名称:mycat-src-1.6.1-RELEASE,代码行数:7,代码来源:UTF8String.java

示例14: readExternal

import java.io.ObjectInput; //导入方法依赖的package包/类
@Override
public void readExternal(final ObjectInput in) throws IOException {
    serialized = new byte[in.readInt()];
    in.readFully(serialized);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:6,代码来源:FrontendType.java

示例15: readExternal

import java.io.ObjectInput; //导入方法依赖的package包/类
@Override
public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
    final int length = in.readInt();
    serialized = new byte[length];
    in.readFully(serialized);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:7,代码来源:CommitTransactionPayload.java


注:本文中的java.io.ObjectInput.readFully方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。