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


Java ObjectOutputStream.writeByte方法代码示例

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


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

示例1: encodeResponse

import java.io.ObjectOutputStream; //导入方法依赖的package包/类
private void encodeResponse(ResponseMessage res, ObjectOutputStream out) throws IOException{
	if(res.isHeartBeat()){
           out.writeObject(null);
       } else {
           // encode response data or error message.
           Throwable th = res.getException();
           if (th == null) {
               Object ret = res.getResponse();
               if (ret == null) {
                   out.writeByte(DubboAdapter.RESPONSE_NULL_VALUE);
               } else {
                   out.writeByte(DubboAdapter.RESPONSE_VALUE);
                   writeObject(ret, out);
               }
           } else {
               out.writeByte(DubboAdapter.RESPONSE_WITH_EXCEPTION);
               writeObject(th, out);
           }
       }
}
 
开发者ID:tiglabs,项目名称:jsf-sdk,代码行数:21,代码来源:JavaEncoder.java

示例2: doReps

import java.io.ObjectOutputStream; //导入方法依赖的package包/类
/**
 * Run benchmark for given number of batches, with given number of cycles
 * for each batch.
 */
void doReps(ObjectOutputStream oout, ObjectInputStream oin,
            StreamBuffer sbuf, int nbatches, int ncycles)
    throws Exception
{
    for (int i = 0; i < nbatches; i++) {
        sbuf.reset();
        for (int j = 0; j < ncycles; j++) {
            oout.writeByte(0);
        }
        oout.flush();
        for (int j = 0; j < ncycles; j++) {
            oin.readByte();
        }
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:20,代码来源:Bytes.java

示例3: serializeMainFile

import java.io.ObjectOutputStream; //导入方法依赖的package包/类
@Override
public void serializeMainFile(ObjectOutputStream objectOutputStream) throws IOException {
    objectOutputStream.writeInt(data.length);
    objectOutputStream.writeLong(nextIDNeverYetAssigned);
    objectOutputStream.writeByte(nextBucketOffset);
    objectOutputStream.writeInt(nextBucketId);
    objectOutputStream.writeInt(nextPartitionId);
    objectOutputStream.writeInt(recycledIdsSize);
    objectOutputStream.writeObject(recycledIds);
}
 
开发者ID:graphflow,项目名称:graphflow,代码行数:11,代码来源:EdgeStore.java

示例4: writeObject

import java.io.ObjectOutputStream; //导入方法依赖的package包/类
private void writeObject(Object obj, ObjectOutputStream oos) throws IOException {
	if( obj == null ) {
		oos.writeByte(0);
	} else {
		oos.writeByte(1);
		oos.writeObject(obj);
	}
}
 
开发者ID:tiglabs,项目名称:jsf-sdk,代码行数:9,代码来源:JavaEncoder.java

示例5: writeObject

import java.io.ObjectOutputStream; //导入方法依赖的package包/类
private void writeObject(ObjectOutputStream out) throws IOException {
    out.writeBoolean(z);
    out.writeByte(b);
    out.writeChar(c);
    out.writeShort(s);
    out.writeInt(i);
    out.writeFloat(f);
    out.writeLong(j);
    out.writeDouble(d);
    out.writeObject(str);
    out.writeObject(parent);
    out.writeObject(left);
    out.writeObject(right);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:15,代码来源:CustomObjTrees.java

示例6: writeObject

import java.io.ObjectOutputStream; //导入方法依赖的package包/类
void writeObject(ObjectOutputStream out) throws IOException {
    out.writeInt(mode);
    for (int i = 0; i < generalNumbers.length; i++) {
        out.writeLong(generalNumbers[i]);
    }

    if (mode == CommonConstants.MODE_THREADS_SAMPLING) {
        out.writeInt(nThreads);
        out.writeInt(nThreadStates);
        for (int i = 0; i < nThreads; i++) {
            out.writeInt(threadIds[i]);
        }
        for (int i = 0; i < nThreadStates; i++) {
            out.writeLong(stateTimestamps[i]);
        }
        int len = nThreads * nThreadStates;
        out.write(threadStates, 0, len);
    } else if (mode == CommonConstants.MODE_THREADS_EXACT) {
        out.writeInt(exactThreadStates.length);
        for (int i = 0; i < exactThreadIds.length; i++) {
            out.writeInt(exactThreadIds[i]);
            out.writeByte(exactThreadStates[i]);
            out.writeLong(exactTimeStamps[i]);
        }
    }

    if (nNewThreads == 0) {
        out.writeInt(0);
    } else {
        out.writeInt(nNewThreads);

        for (int i = 0; i < nNewThreads; i++) {
            out.writeInt(newThreadIds[i]);
            out.writeUTF(newThreadNames[i]);
            out.writeUTF(newThreadClassNames[i]);
        }
    }

    out.writeInt(gcStarts.length);

    for (int i = 0; i < gcStarts.length; i++) {
        out.writeLong(gcStarts[i]);
    }

    out.writeInt(gcFinishs.length);

    for (int i = 0; i < gcFinishs.length; i++) {
        out.writeLong(gcFinishs[i]);
    }

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

示例7: doCall

import java.io.ObjectOutputStream; //导入方法依赖的package包/类
private void doCall ( DataInputStream in, DataOutputStream out, Object payload ) throws Exception {
    ObjectInputStream ois = new ObjectInputStream(in) {

        @Override
        protected Class<?> resolveClass ( ObjectStreamClass desc ) throws IOException, ClassNotFoundException {
            if ( "[Ljava.rmi.server.ObjID;".equals(desc.getName())) {
                return ObjID[].class;
            } else if ("java.rmi.server.ObjID".equals(desc.getName())) {
                return ObjID.class;
            } else if ( "java.rmi.server.UID".equals(desc.getName())) {
                return UID.class;
            }
            throw new IOException("Not allowed to read object");
        }
    };

    ObjID read;
    try {
        read = ObjID.read(ois);
    }
    catch ( java.io.IOException e ) {
        throw new MarshalException("unable to read objID", e);
    }


    if ( read.hashCode() == 2 ) {
        ois.readInt(); // method
        ois.readLong(); // hash
        System.err.println("Is DGC call for " + Arrays.toString((ObjID[])ois.readObject()));
    }

    System.err.println("Sending return with payload for obj " + read);

    out.writeByte(TransportConstants.Return);// transport op
    ObjectOutputStream oos = new JRMPClient.MarshalOutputStream(out, this.classpathUrl);

    oos.writeByte(TransportConstants.ExceptionalReturn);
    new UID().write(oos);

    BadAttributeValueExpException ex = new BadAttributeValueExpException(null);
    Reflections.setFieldValue(ex, "val", payload);
    oos.writeObject(ex);

    oos.flush();
    out.flush();

    this.hadConnection = true;
    synchronized ( this.waitLock ) {
        this.waitLock.notifyAll();
    }
}
 
开发者ID:hucheat,项目名称:APacheSynapseSimplePOC,代码行数:52,代码来源:JRMPListener.java

示例8: writeObject

import java.io.ObjectOutputStream; //导入方法依赖的package包/类
private void writeObject( ObjectOutputStream out ) throws IOException {

		bucketLocker.lockAllBuckets();

		final Serialization serialization = new Serialization();

		// Write bucket values
		out.writeInt( fpBits );
		out.writeInt( buckets.getEntriesPerBucket() );
		out.writeLong( buckets.getBucketCount() );
		out.writeBoolean( buckets.isCountingDisabled() );
		out.writeLong( buckets.getInsertedCount() );
		buckets.writeMemory( out );

		// Write kicked values
		out.writeInt( kickedValues.getKickedFingerprint() );
		out.writeLong( kickedValues.getKickedBucket() );

		// Write bucket locker values
		out.writeInt( bucketLocker.getConcurrency() );

		// Write swapper values
		out.writeInt( swapper.getMaxKicks() );
		// Write random int provider
		final byte randomIntType = serialization.getRandomIntType( swapper.getRandomInt() );
		out.writeByte( randomIntType );
		if ( serialization.isCustomType( randomIntType ) ) {
			out.writeObject( swapper.getRandomInt() );
		}

		// Write string encoder
		final byte stringEncoderType = serialization.getStringEncoderType( stringEncoder );
		out.writeByte( stringEncoderType );
		if ( serialization.isCustomType( stringEncoderType ) ) {
			out.writeObject( stringEncoder );
		}

		// Write bucket hasher
		final byte bucketHasherType = serialization.getBucketHasherType( bucketHasher );
		out.writeByte( bucketHasherType );
		if ( serialization.isCustomType( bucketHasherType ) ) {
			out.writeObject( bucketHasher );
		} else {
			out.writeInt( bucketHasher.getSeed() );
		}

		// Write fingerprint hasher
		final byte fpHasherType = serialization.getFingerprintHasherType( fpHasher );
		out.writeByte( fpHasherType );
		if ( serialization.isCustomType( fpHasherType ) ) {
			out.writeObject( fpHasher );
		}

		bucketLocker.unlockAllBuckets();
	}
 
开发者ID:cinnom,项目名称:nano-cuckoo,代码行数:56,代码来源:NanoCuckooFilter.java

示例9: doCall

import java.io.ObjectOutputStream; //导入方法依赖的package包/类
private void doCall ( DataInputStream in, DataOutputStream out, Object payload ) throws Exception {
    ObjectInputStream ois = new ObjectInputStream(in) {

        @Override
        protected Class<?> resolveClass ( ObjectStreamClass desc ) throws IOException, ClassNotFoundException {
            if ( "[Ljava.rmi.server.ObjID;".equals(desc.getName())) {
                return ObjID[].class;
            } else if ("java.rmi.server.ObjID".equals(desc.getName())) {
                return ObjID.class;
            } else if ( "java.rmi.server.UID".equals(desc.getName())) {
                return UID.class;
            }
            throw new IOException("Not allowed to read object");
        }
    };

    ObjID read;
    try {
        read = ObjID.read(ois);
    }
    catch ( java.io.IOException e ) {
        throw new MarshalException("unable to read objID", e);
    }

    
    if ( read.hashCode() == 2 ) {
        ois.readInt(); // method
        ois.readLong(); // hash
        System.err.println("Is DGC call for " + Arrays.toString((ObjID[])ois.readObject()));
    }
    
    System.err.println("Sending return with payload for obj " + read);

    out.writeByte(TransportConstants.Return);// transport op
    ObjectOutputStream oos = new JRMPClient.MarshalOutputStream(out, this.classpathUrl);

    oos.writeByte(TransportConstants.ExceptionalReturn);
    new UID().write(oos);

    BadAttributeValueExpException ex = new BadAttributeValueExpException(null);
    Reflections.setFieldValue(ex, "val", payload);
    oos.writeObject(ex);

    oos.flush();
    out.flush();

    this.hadConnection = true;
    synchronized ( this.waitLock ) {
        this.waitLock.notifyAll();
    }
}
 
开发者ID:pimps,项目名称:ysoserial-modified,代码行数:52,代码来源:JRMPListener.java

示例10: exportType

import java.io.ObjectOutputStream; //导入方法依赖的package包/类
private void exportType(TypeDef te, ObjectOutputStream out)throws IOException{
    out.writeUTF(te.getName());
    out.writeBoolean(te.classExplicit());
    
    //escludere membri override
    Membro[] i=te.getMembri();
    int l=0;
    for(Membro m:i){
        if(!m.override)
            l++;
    }
    out.writeInt(l);
    for(Membro mem:i){
        if(mem.override)
            continue;
        int perms=0;
        //non ci sono override
        if(mem.gpacked)
            perms=1;
        else if(mem.ghost)
            perms=2;
        perms*=3;
        if(mem.shadow)
            perms+=1;
        if(mem.read)
            perms+=2;
        out.writeByte(perms & 0xFF);
        out.writeObject(mem.getType());
        out.writeUTF(mem.getIdent());
        out.writeInt(mem.params.length);
        for(TypeName t:mem.params)
            out.writeObject(t);
        if(mem.packed==null)
            out.writeBoolean(false);
        else{
            out.writeBoolean(true);
            //Sicuramente NumDich
            out.writeLong(((NumDich)mem.packed).getNum());
        }
    }
    if(te.extend()!=null){
        out.writeBoolean(true);
        out.writeObject(te.extend());
    }
    else
        out.writeBoolean(false);
}
 
开发者ID:Loara,项目名称:Meucci,代码行数:48,代码来源:ModLoader.java


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