本文整理汇总了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));
}
}
示例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 );
}
}
}
示例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;
}
示例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);
}
示例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();
}
示例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);
}
示例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));
}
示例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);
}
示例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;
}
示例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);
}
示例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());
}
}
示例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());
}
}
示例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);
}
示例14: readExternal
import java.io.ObjectInput; //导入方法依赖的package包/类
@Override
public void readExternal(final ObjectInput in) throws IOException {
serialized = new byte[in.readInt()];
in.readFully(serialized);
}
示例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);
}