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


Java ObjectInputStream.readUTF方法代码示例

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


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

示例1: 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

示例2: SVMExamples

import java.io.ObjectInputStream; //导入方法依赖的package包/类
/** Reads an example set from the given input stream. */
public SVMExamples(ObjectInputStream in) throws IOException {
	this(in.readInt(), in.readDouble());
	this.dim = in.readInt();
	String scaleString = in.readUTF();
	if (scaleString.equals("scale")) {
		int numberOfAttributes = in.readInt();
		this.meanVarianceMap = new HashMap<Integer, MeanVariance>();
		for (int i = 0; i < numberOfAttributes; i++) {
			int index = in.readInt();
			double mean = in.readDouble();
			double variance = in.readDouble();
			meanVarianceMap.put(Integer.valueOf(index), new MeanVariance(mean, variance));
		}
	}
	for (int e = 0; e < this.train_size; e++) {
		index[e] = new int[in.readInt()];
		atts[e] = new double[index[e].length];
		for (int a = 0; a < index[e].length; a++) {
			index[e][a] = in.readInt();
			atts[e][a] = in.readDouble();
		}
		alphas[e] = in.readDouble();
		ys[e] = in.readDouble();
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:27,代码来源:SVMExamples.java

示例3: importCall

import java.io.ObjectInputStream; //导入方法依赖的package包/类
private FElement importCall(ObjectInputStream in, String modulo)throws IOException,
        ClassNotFoundException{
    String name=in.readUTF();
    String modname=in.readUTF();
    boolean shd=in.readBoolean();
    TypeName ret;
    ret=(TypeName)in.readObject();
    int i=in.readInt();
    TypeName[] ty=new TypeName[i];
    for(int j=0; j<i; j++)
        ty[j]=(TypeName)in.readObject();
    boolean op=in.readBoolean();
    String[] err = new String[in.readInt()];
    for(int u =0; u<err.length; u++)
        err[u]=in.readUTF();
    return new FElement(name, modname, ty, ret, op, shd, modulo, false, err);
}
 
开发者ID:Loara,项目名称:Meucci,代码行数:18,代码来源:ModLoader.java

示例4: readObject

import java.io.ObjectInputStream; //导入方法依赖的package包/类
private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
    ois.defaultReadObject();

    // custom deserialization, Android's Uri class is not serializable
    if (ois.readInt() != 0) {
        String uriString = ois.readUTF();
        photoThumbnailUri = Uri.parse(uriString);
    }
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:10,代码来源:RecipientSelectView.java

示例5: performClassId

import java.io.ObjectInputStream; //导入方法依赖的package包/类
private void performClassId(ObjectInputStream in, ObjectOutputStream out) throws IOException {
    String className = in.readUTF();
    Long id = ((NbRemoteLoader)loader).getClassId(className);
    out.writeInt(RemoteCodes.RESULT_SUCCESS);
    if (id == null) {
        out.writeLong(-1);
    } else {
        out.writeLong(id);
    }
    out.flush();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:AgentWorker.java

示例6: processHandshake

import java.io.ObjectInputStream; //导入方法依赖的package包/类
private void processHandshake(SocketChannel accepted) throws IOException {
    accepted.configureBlocking(true);
    Socket sock = accepted.socket();
    sock.setSoTimeout(HANDSHAKE_TIMEOUT);
    
    ObjectInputStream is = new ObjectInputStream(sock.getInputStream());
    String authorizationKey = is.readUTF();
    LOG.log(Level.FINE, "Approaching agent with authorization key: {0}", authorizationKey);
    ShellAgent agent;
    
    synchronized (ShellLaunchManager.this) {
        agent = registeredAgents.get(authorizationKey);
    }
    if (agent == null) {
        LOG.log(Level.INFO, "Connection on Java Shell agent port with improper authorization ({0}) from {1}", new Object[] {
            authorizationKey,
            sock
        });
        return;
    }
    
    // read the port
    int targetPort = is.readInt();
    InetSocketAddress connectTo = new InetSocketAddress(
            ((InetSocketAddress)sock.getRemoteSocketAddress()).getAddress(), targetPort);
    
    agent.target(connectTo);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:29,代码来源:ShellLaunchManager.java

示例7: readObject

import java.io.ObjectInputStream; //导入方法依赖的package包/类
void readObject(ObjectInputStream in) throws IOException {
    agentVersion = in.readInt();
    jdkVersionString = in.readUTF();
    javaClassPath = in.readUTF();
    javaExtDirs = in.readUTF();
    bootClassPath = in.readUTF();
    workingDir = in.readUTF();
    jvmArguments = in.readUTF();
    javaCommand = in.readUTF();
    targetMachineOSName = in.readUTF();
    maxHeapSize = in.readLong();
    startupTimeMillis = in.readLong();
    startupTimeInCounts = in.readLong();
    agentId = in.readInt();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:VMPropertiesResponse.java

示例8: call

import java.io.ObjectInputStream; //导入方法依赖的package包/类
@Override
public String call() throws Exception {

    int trials = 0;
    while(trials < Config.MESSAGE_MAX_TRIALS) {
        try {
            log.trace(p.getPeerServerPort());
            log.trace(p.getAddress());
            Socket messagedClient = new Socket(p.getAddress(), p.getPeerServerPort());
            messagedClient.setSoTimeout(Config.MESSAGE_TIMEOUT);
            ObjectOutputStream out = new ObjectOutputStream(messagedClient.getOutputStream());
            out.writeInt(Config.MESSAGE_OUTGOING_RESPONSE);
            out.writeUTF(msg);
            out.flush();

            ObjectInputStream in = new ObjectInputStream(new DataInputStream(messagedClient.getInputStream()));
            int ack = in.readInt();

            if (ack == Config.MESSAGE_ACK) {
                String response = in.readUTF();
                return response;
            } else {
                log.trace("Non flag read");
            }
            messagedClient.close();

        } catch (IOException e) {
            log.warn("EXCEPTIOON\n\n\n");
            log.warn(e);
            trials++;
            continue;
        }
        trials++;
    }
    log.warn("Message cannot be sent after " + Config.MESSAGE_MAX_TRIALS + " trials");
    log.warn(msg);
    return null;
}
 
开发者ID:CrypDist,项目名称:CrypDist,代码行数:39,代码来源:ResponsedMessageTask.java

示例9: readObject

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

    Long first = in.readLong();
    Long second = in.readLong();
    if (first >= 0 || second >= 0) {
        mCoordinates = new Pair<>(first >= 0 ? first : null, second >= 0 ? second : null);
    }

    mLocation = new Location(in.readUTF());
    mLocation.setLatitude(in.readDouble());
    mLocation.setLongitude(in.readDouble());
    mLocation.setAccuracy(in.readFloat());
    mLocation.setAltitude(in.readDouble());
}
 
开发者ID:suomenriistakeskus,项目名称:oma-riista-android,代码行数:16,代码来源:GameHarvest.java

示例10: readUTF

import java.io.ObjectInputStream; //导入方法依赖的package包/类
private String readUTF(ObjectInputStream ois) throws IOException {
	int len = ois.readInt();
	if( len < 0 )
		return null;

	return ois.readUTF();
}
 
开发者ID:tiglabs,项目名称:jsf-sdk,代码行数:8,代码来源:JavaDecoder.java

示例11: importType

import java.io.ObjectInputStream; //导入方法依赖的package包/类
private TypeElem importType(ObjectInputStream in, String modulo)throws IOException,
        ClassNotFoundException{
    String name=in.readUTF();
    boolean explic=in.readBoolean();
    int i=in.readInt();
    Membro[] mem=new Membro[i];
    for(int j=0; j<i; j++){
        int perms=in.readByte()&0xFF;
        TypeName ty=(TypeName)in.readObject();
        String na=in.readUTF();
        int len=in.readInt();
        TypeName[] par=new TypeName[len];
        for(int k=0; k<len; k++)
            par[k]=(TypeName)in.readObject();
        TemplateEle pack=null;
        if(in.readBoolean())
            pack=new NumDich(in.readLong(), 2);
        boolean shadow=(perms % 3)==1;
        boolean read=(perms % 3)==2;
        perms=perms/3;
        boolean gpacked=(perms % 3)==1;
        boolean ghost=(perms % 3)==2;
        mem[j]=new Membro(ty, na, par, shadow, read, gpacked, ghost, pack);
    }
    TypeName ex=null;
    if(in.readBoolean())
        ex=(TypeName)in.readObject();
    return new TypeElem(name, ex, mem, modulo, explic);
}
 
开发者ID:Loara,项目名称:Meucci,代码行数:30,代码来源:ModLoader.java

示例12: restoreState

import java.io.ObjectInputStream; //导入方法依赖的package包/类
public synchronized boolean restoreState() {
	try {
		ObjectInputStream in = new ObjectInputStream(new FileInputStream(statefile));
		String u = in.readUTF();
		if (!(url == null || url.length() < 1)) {
			u = url;
		}
		setUrl(u);
		creditential = (Credential) in.readObject();
		fileName = in.readUTF();
		String finalFileName2 = in.readUTF();
		if (finalFileName == null) {
			finalFileName = finalFileName2;
		}
		String destdir2 = in.readUTF();
		if (destdir == null)
			setDestdir(destdir2);
		length = in.readLong();
		downloaded = in.readLong();
		int sz = in.readInt();
		fileList = new ArrayList<ChunkFileInfo>();
		for (int i = 0; i < sz; i++) {
			fileList.add((ChunkFileInfo) in.readObject());
		}
		sz = in.readInt();
		list = new ArrayList<Connection>();
		for (int i = 0; i < sz; i++) {
			Connection.State state = (Connection.State) in.readObject();
			state.url = url;
			if (url.startsWith("http"))
				list.add(new HttpConnection(state, timeout, this, lock, creditential, config));
			else
				list.add(new FTPConnection(state, timeout, this, lock, creditential, config));
		}
		prevdownload = in.readLong();
		overwrite = in.readBoolean();
		in.close();
		return true;
	} catch (Exception e) {
		e.printStackTrace();
		System.out.println(e.getMessage());
		return false;
	}
}
 
开发者ID:kmarius,项目名称:xdman,代码行数:45,代码来源:ConnectionManager.java

示例13: 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

示例14: readObject

import java.io.ObjectInputStream; //导入方法依赖的package包/类
void readObject(ObjectInputStream in) throws IOException {
    className = in.readUTF();
    classLoaderId = in.readInt();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:GetClassIdCommand.java

示例15: readObject

import java.io.ObjectInputStream; //导入方法依赖的package包/类
void readObject(ObjectInputStream in) throws IOException {
    className = in.readUTF();
    classLoaderId = in.readInt();
    methodName = in.readUTF();
    methodSignature = in.readUTF();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:MethodLoadedCommand.java


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