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


Java ObjectInputStream.readFully方法代码示例

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


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

示例1: readObject

import java.io.ObjectInputStream; //导入方法依赖的package包/类
void readObject(ObjectInputStream in) throws IOException {
    int nClasses = in.readInt();

    if (nClasses == 0) {
        return;
    }

    classBytes = new byte[nClasses][];

    for (int i = 0; i < nClasses; i++) {
        int len = in.readInt();

        if (len > 0) {
            classBytes[i] = new byte[len];
            in.readFully(classBytes[i]);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:GetClassFileBytesResponse.java

示例2: readObject

import java.io.ObjectInputStream; //导入方法依赖的package包/类
void readObject(ObjectInputStream in) throws IOException {
    className = in.readUTF();
    thisAndParentLoaderData = new int[3];

    for (int i = 0; i < 3; i++) {
        thisAndParentLoaderData[i] = in.readInt();
    }

    int len = in.readInt();

    if (len == 0) {
        classFileBytes = null;
    } else {
        classFileBytes = new byte[len];
        in.readFully(classFileBytes);
    }

    threadInCallGraph = in.readBoolean();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:ClassLoadedCommand.java

示例3: readMetadata

import java.io.ObjectInputStream; //导入方法依赖的package包/类
public void readMetadata() throws IOException, ClassNotFoundException {
	final ObjectInputStream ois = new ObjectInputStream(new FastBufferedInputStream(new FileInputStream(new File(directory, "metadata"))));
	byteArrayDiskQueues.size = ois.readLong();
	byteArrayDiskQueues.appendPointer = ois.readLong();
	byteArrayDiskQueues.used = ois.readLong();
	byteArrayDiskQueues.allocated = ois.readLong();
	final int n = ois.readInt();
	byteArrayDiskQueues.buffers.size(n);
	byteArrayDiskQueues.files.size(n);
	final VisitStateSet schemeAuthority2VisitState = frontier.distributor.schemeAuthority2VisitState;
	byte[] schemeAuthority = new byte[1024];
	for(int i = ois.readInt(); i-- != 0;) {
		final int length = Util.readVByte(ois);
		if (schemeAuthority.length < length) schemeAuthority = new byte[length];
		ois.readFully(schemeAuthority, 0, length);
		final VisitState visitState = schemeAuthority2VisitState.get(schemeAuthority, 0, length);
		// This can happen if the serialization of the visit states has not been completed.
		if (visitState != null) byteArrayDiskQueues.key2QueueData.put(visitState, (QueueData)ois.readObject());
		else LOGGER.error("No visit state found for " + Util.toString(schemeAuthority));
	}

	ois.close();
}
 
开发者ID:LAW-Unimi,项目名称:BUbiNG,代码行数:24,代码来源:WorkbenchVirtualizer.java

示例4: readObject

import java.io.ObjectInputStream; //导入方法依赖的package包/类
void readObject(ObjectInputStream in) throws IOException {
    int len = in.readInt();
    packedData = new byte[len];
    in.readFully(packedData);
    len = in.readInt();
    packedArrayOffsets = new int[len];

    for (int i = 0; i < len; i++) {
        packedArrayOffsets[i] = in.readInt();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:MethodNamesResponse.java

示例5: readObject

import java.io.ObjectInputStream; //导入方法依赖的package包/类
/**
 * Deserialize the {@code CertificateRevokedException} instance.
 */
private void readObject(ObjectInputStream ois)
    throws IOException, ClassNotFoundException {
    // Read in the non-transient fields
    // (revocationDate, reason, authority)
    ois.defaultReadObject();

    // Defensively copy the revocation date
    revocationDate = new Date(revocationDate.getTime());

    // Read in the size (number of mappings) of the extensions map
    // and create the extensions map
    int size = ois.readInt();
    if (size == 0) {
        extensions = Collections.emptyMap();
    } else {
        extensions = new HashMap<String, Extension>(size);
    }

    // Read in the extensions and put the mappings in the extensions map
    for (int i = 0; i < size; i++) {
        String oid = (String) ois.readObject();
        boolean critical = ois.readBoolean();
        int length = ois.readInt();
        byte[] extVal = new byte[length];
        ois.readFully(extVal);
        Extension ext = sun.security.x509.Extension.newExtension
            (new ObjectIdentifier(oid), critical, extVal);
        extensions.put(oid, ext);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:34,代码来源:CertificateRevokedException.java

示例6: readObject

import java.io.ObjectInputStream; //导入方法依赖的package包/类
/**
 * Reconstitute this object from a stream (i.e., deserialize it).
 *
 * We handle both JDK 1.1
 * binary formats and full formats with a packed byte array.
 */
private void readObject(ObjectInputStream stream)
     throws IOException, ClassNotFoundException
{
    stream.defaultReadObject();

    if (serialVersionOnStream < 1) {
        // Fix a bug in the 1.1 SimpleTimeZone code -- namely,
        // startDayOfWeek and endDayOfWeek were usually uninitialized.  We can't do
        // too much, so we assume SUNDAY, which actually works most of the time.
        if (startDayOfWeek == 0) {
            startDayOfWeek = Calendar.SUNDAY;
        }
        if (endDayOfWeek == 0) {
            endDayOfWeek = Calendar.SUNDAY;
        }

        // The variables dstSavings, startMode, and endMode are post-1.1, so they
        // won't be present if we're reading from a 1.1 stream.  Fix them up.
        startMode = endMode = DOW_IN_MONTH_MODE;
        dstSavings = millisPerHour;
    } else {
        // For 1.1.4, in addition to the 3 new instance variables, we also
        // store the actual rules (which have not be made compatible with 1.1)
        // in the optional area.  Read them in here and parse them.
        int length = stream.readInt();
        byte[] rules = new byte[length];
        stream.readFully(rules);
        unpackRules(rules);
    }

    if (serialVersionOnStream >= 2) {
        int[] times = (int[]) stream.readObject();
        unpackTimes(times);
    }

    serialVersionOnStream = currentSerialVersion;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:44,代码来源:SimpleTimeZone.java

示例7: readObject

import java.io.ObjectInputStream; //导入方法依赖的package包/类
/**
 * Deserialize the {@code CertificateRevokedException} instance.
 */
private void readObject(ObjectInputStream ois)
    throws IOException, ClassNotFoundException {
    // Read in the non-transient fields
    // (revocationDate, reason, authority)
    ois.defaultReadObject();

    // Defensively copy the revocation date
    revocationDate = new Date(revocationDate.getTime());

    // Read in the size (number of mappings) of the extensions map
    // and create the extensions map
    int size = ois.readInt();
    if (size == 0) {
        extensions = Collections.emptyMap();
    } else {
        extensions = new HashMap<>(size);
    }

    // Read in the extensions and put the mappings in the extensions map
    for (int i = 0; i < size; i++) {
        String oid = (String) ois.readObject();
        boolean critical = ois.readBoolean();
        int length = ois.readInt();
        byte[] extVal = new byte[length];
        ois.readFully(extVal);
        Extension ext = sun.security.x509.Extension.newExtension
            (new ObjectIdentifier(oid), critical, extVal);
        extensions.put(oid, ext);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:34,代码来源:CertificateRevokedException.java

示例8: readObject

import java.io.ObjectInputStream; //导入方法依赖的package包/类
/**
 * Loads (deserializes) this node's content from the source stream.
 * 
 * @param in
 *            source stream
 * 
 * @throws IOException
 *             any I/O exception
 * @throws ClassNotFoundException
 *             class not found
 */
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
	in.defaultReadObject();
	byte[] bytes = new byte[in.readInt()];
	in.readFully(bytes);
	try {
		value = JavaBuiltin.deserialize(bytes);
	} catch (Exception e) {
		throw new IOException(e);
	}
	moveMeta();
}
 
开发者ID:berkesa,项目名称:datatree,代码行数:23,代码来源:Tree.java

示例9: readObject

import java.io.ObjectInputStream; //导入方法依赖的package包/类
void readObject(ObjectInputStream gin) throws IOException {
    GZIPInputStream eix = new GZIPInputStream(gin, 32768);
    ObjectInputStream in = new ObjectInputStream(eix);
    byte[] EMPTY = new byte[0];
    classCount = in.readInt();
    allLoadedClassNames = new String[classCount];

    for (int i = 0; i < classCount; i++) {
        allLoadedClassNames[i] = in.readUTF().replace('.', '/').intern();   // NOI18N
    }

    allLoadedClassLoaderIds = new int[classCount];

    for (int i = 0; i < classCount; i++) {
        allLoadedClassLoaderIds[i] = in.readInt();
    }

    int len = in.readInt();

    if (len == 0) {
        cachedClassFileBytes = null;
    } else {
        cachedClassFileBytes = new byte[len][];

        for (int i = 0; i < len; i++) {
            int bytesLen = in.readInt();

            if (bytesLen == -1) {
                continue;
            }
            if (bytesLen == 0) {
               cachedClassFileBytes[i] = EMPTY;
               continue;
            }
            cachedClassFileBytes[i] = new byte[bytesLen];
            in.readFully(cachedClassFileBytes[i]);
        }
    }

    allLoadedClassesSuper = new int[classCount];
    for (int i = 0; i < classCount; i++) {
        allLoadedClassesSuper[i] = in.readInt();
    }

    allLoadedClassesInterfaces = new int[classCount][];
    for (int i = 0; i < classCount; i++) {
        int ilen = in.readInt();
        allLoadedClassesInterfaces[i] = new int[ilen];
        for (int j = 0; j < ilen; j++) {
            allLoadedClassesInterfaces[i][j] = in.readInt();
        }
    }
    
    len = in.readInt();
    parentLoaderIds = new int[len];

    for (int i = 0; i < len; i++) {
        parentLoaderIds[i] = in.readInt();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:61,代码来源:RootClassLoadedCommand.java

示例10: readObject

import java.io.ObjectInputStream; //导入方法依赖的package包/类
void readObject(ObjectInputStream in) throws IOException {
    nClasses = in.readInt();

    if (nClasses == 0) {
        return;
    }

    if ((instrMethodClasses == null) || (nClasses > instrMethodClasses.length)) {
        instrMethodClasses = new String[nClasses];
        instrMethodClassLoaderIds = new int[nClasses];
    }

    for (int i = 0; i < nClasses; i++) {
        instrMethodClasses[i] = in.readUTF();
        instrMethodClassLoaderIds[i] = in.readInt();
    }

    nMethods = in.readInt();

    int code = in.read();

    if (code != 0) {
        if ((instrMethodLeaf == null) || (nMethods > instrMethodLeaf.length)) {
            instrMethodLeaf = new boolean[nMethods];
        }

        for (int i = 0; i < nMethods; i++) {
            instrMethodLeaf[i] = in.readBoolean();
        }
    } else {
        instrMethodLeaf = null;
    }

    addInfo = in.readInt();

    if ((replacementClassFileBytes == null) || (nClasses > replacementClassFileBytes.length)) {
        replacementClassFileBytes = new byte[nClasses][];
    }

    for (int i = 0; i < nClasses; i++) {
        int len = in.readInt();

        if (len > 0) {
            replacementClassFileBytes[i] = new byte[len];
            in.readFully(replacementClassFileBytes[i]);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:49,代码来源:InstrumentMethodGroupData.java

示例11: readObject

import java.io.ObjectInputStream; //导入方法依赖的package包/类
void readObject(ObjectInputStream in) throws IOException {
    int len = in.readInt();
    status = new byte[len];
    in.readFully(status);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:6,代码来源:ThreadLivenessStatusResponse.java

示例12: readObject

import java.io.ObjectInputStream; //导入方法依赖的package包/类
void readObject(ObjectInputStream in) throws IOException {
    int arrSize;

    mode = in.readInt();
    for (int i = 0; i < generalNumbers.length; i++) {
        generalNumbers[i] = in.readLong();
    }

    if (mode == CommonConstants.MODE_THREADS_SAMPLING) {
        nThreads = in.readInt();
        nThreadStates = in.readInt();
        if (threadIds.length < nThreads) {
            threadIds = new int[nThreads];
        }
        if (stateTimestamps.length < nThreadStates) {
            stateTimestamps = new long[nThreadStates];
        }
        
        int len = nThreads * nThreadStates;
        
        if (threadStates.length < len) {
            threadStates = new byte[len];
        }
        for (int i = 0; i < nThreads; i++) {
            threadIds[i] = in.readInt();
        }
        for (int i = 0; i < nThreadStates; i++) {
            stateTimestamps[i] = in.readLong();
        }
        in.readFully(threadStates, 0, len);
    }  else if (mode == CommonConstants.MODE_THREADS_EXACT) {
        int exactLen = in.readInt();
        exactThreadIds = new int[exactLen];
        exactThreadStates = new byte[exactLen];
        exactTimeStamps = new long[exactLen];
        
        for (int i = 0; i < exactLen; i++) {
            exactThreadIds[i] = in.readInt();
            exactThreadStates[i] = in.readByte();
            exactTimeStamps[i] = in.readLong();
        }
    }

    nNewThreads = in.readInt();

    if (nNewThreads > 0) {
        if ((newThreadIds == null) || (newThreadIds.length < nNewThreads)) {
            newThreadIds = new int[nNewThreads];
            newThreadNames = new String[nNewThreads];
            newThreadClassNames = new String[nNewThreads];
        }

        for (int i = 0; i < nNewThreads; i++) {
            newThreadIds[i] = in.readInt();
            newThreadNames[i] = in.readUTF();
            newThreadClassNames[i] = in.readUTF();
        }
    }

    arrSize = in.readInt();
    gcStarts = new long[arrSize];

    for (int i = 0; i < arrSize; i++) {
        gcStarts[i] = in.readLong();
    }

    arrSize = in.readInt();
    gcFinishs = new long[arrSize];

    for (int i = 0; i < arrSize; i++) {
        gcFinishs[i] = in.readLong();
    }

    Arrays.sort(gcStarts);
    Arrays.sort(gcFinishs);

    serverState = in.readInt();
    serverProgress = in.readInt();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:80,代码来源:MonitoredNumbersResponse.java

示例13: readObject

import java.io.ObjectInputStream; //导入方法依赖的package包/类
private void readObject(ObjectInputStream in
                        ) throws IOException, ClassNotFoundException {
  byte[] buf = new byte[in.readInt()];
  in.readFully(buf);
  metadata = new Metadata(buf);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:7,代码来源:JavaKeyStoreProvider.java

示例14: readByteArray

import java.io.ObjectInputStream; //导入方法依赖的package包/类
/** Reads a byte array prefixed by its length encoded using vByte.
 *
 * @param s the stream from which the array should be read.
 * @return the array.
 */
public final static byte[] readByteArray(final ObjectInputStream s) throws IOException {
	final byte[] a = new byte[readVByte(s)];
	s.readFully(a);
	return a;
}
 
开发者ID:LAW-Unimi,项目名称:BUbiNG,代码行数:11,代码来源:Util.java


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