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


Java DataInputStream.readBoolean方法代码示例

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


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

示例1: read

import java.io.DataInputStream; //导入方法依赖的package包/类
@Override
public void read(DataInputStream input) throws IOException {
    PotionEffectType type = PotionEffectType.getById(input.readInt());
    int duration = input.readInt();
    int amplifier = input.readInt();
    boolean aimbient = input.readBoolean();
    boolean particles = input.readBoolean();
    int r = input.readInt();
    int g = input.readInt();
    int b = input.readInt();
    Color color = Color.fromRGB(r, g, b);
    
    setValue(new PotionEffect(
            type,
            duration, amplifier,
            aimbient, particles, color
    ));
}
 
开发者ID:OrigamiDream,项目名称:Leveled-Storage,代码行数:19,代码来源:PotionEffectStorage.java

示例2: revalidate

import java.io.DataInputStream; //导入方法依赖的package包/类
protected void revalidate(QuorumPacket qp) throws IOException {
    ByteArrayInputStream bis = new ByteArrayInputStream(qp
            .getData());
    DataInputStream dis = new DataInputStream(bis);
    long sessionId = dis.readLong();
    boolean valid = dis.readBoolean();
    ServerCnxn cnxn = pendingRevalidations.remove(sessionId);
    if (cnxn == null) {
        LOG.warn("Missing session 0x"
                + Long.toHexString(sessionId)
                + " for validation");
    } else {
        zk.finishSessionInit(cnxn, valid);
    }
    if (LOG.isTraceEnabled()) {
        ZooTrace.logTraceMessage(LOG,
                ZooTrace.SESSION_TRACE_MASK,
                "Session 0x" + Long.toHexString(sessionId)
                + " is valid: " + valid);
    }
}
 
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:22,代码来源:Learner.java

示例3: readState

import java.io.DataInputStream; //导入方法依赖的package包/类
/** Reads the entire state of the MersenneTwister RNG from the stream. */
public synchronized void readState(DataInputStream stream) throws IOException {
  int len = mt.length;
  for (int x = 0; x < len; x++) {
    mt[x] = stream.readInt();
  }

  len = mag01.length;
  for (int x = 0; x < len; x++) {
    mag01[x] = stream.readInt();
  }

  mti = stream.readInt();
  nextNextGaussian = stream.readDouble();
  haveNextNextGaussian = stream.readBoolean();
}
 
开发者ID:johntiger1,项目名称:boqa,代码行数:17,代码来源:MersenneTwister.java

示例4: read

import java.io.DataInputStream; //导入方法依赖的package包/类
@Override
public void read(DataInputStream input) throws IOException {
    super.read(input);
    
    getValue().setScaling(input.readBoolean());
    
    boolean hasLocationName = input.readBoolean();
    if(hasLocationName) {
        getValue().setLocationName(input.readUTF());
    }
    
    boolean hasColor = input.readBoolean();
    if(hasColor) {
        getValue().setColor(Color.fromRGB(input.readInt(), input.readInt(), input.readInt()));
    }
}
 
开发者ID:OrigamiDream,项目名称:Leveled-Storage,代码行数:17,代码来源:MapMetaStorage.java

示例5: read

import java.io.DataInputStream; //导入方法依赖的package包/类
@Override
public void read(DataInputStream in) throws IOException {
    final int version = in.readInt();
    switch (version) {
        case VERSION_INIT:
            throw new ProtocolException("Ignored upgrade");
        case VERSION_ADD_ROOT:
            if (in.readBoolean()) {
                root = new RootInfo();
                root.read(in);
            }
            final int size = in.readInt();
            for (int i = 0; i < size; i++) {
                final DocumentInfo doc = new DocumentInfo();
                doc.read(in);
                add(doc);
            }
            break;
        default:
            throw new ProtocolException("Unknown version " + version);
    }
}
 
开发者ID:medalionk,项目名称:simple-share-android,代码行数:23,代码来源:DocumentStack.java

示例6: CharSet

import java.io.DataInputStream; //导入方法依赖的package包/类
/**
 * Create a new character set based on the contents of a file
 * 
 * @param source The source of the character set
 * @throws IOException Indicates a failure to read from the source
 */
public CharSet(File source) throws IOException {
	this.source = source;
	mutable = true;
	DataInputStream din = new DataInputStream(new FileInputStream(source));
	name = din.readUTF();
	for (int i=0;i<256;i++) {
		chars[i] = din.readBoolean();
	}
	din.close();
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:17,代码来源:CharSet.java

示例7: readFromStream

import java.io.DataInputStream; //导入方法依赖的package包/类
public void readFromStream(DataInputStream in) throws IOException {
    super.readFromStream(in);

    nProfiledClasses = in.readInt();
    classNames = new String[nProfiledClasses];
    objectsSizePerClass = new long[nProfiledClasses];

    for (int i = 0; i < nProfiledClasses; i++) {
        classNames[i] = in.readUTF();
        objectsSizePerClass[i] = in.readLong();
    }

    if (in.readBoolean()) {
        int len = in.readInt();
        //System.err.println("Read len: " +len);
        stacksForClasses = new RuntimeMemoryCCTNode[len];

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

            //System.err.println("  [" + i + "] = " + type);
            if (type != 0) {
                stacksForClasses[i] = RuntimeMemoryCCTNode.create(type);
                stacksForClasses[i].readFromStream(in);
            }
        }

        if (in.readBoolean()) {
            table = new JMethodIdTable();
            table.readFromStream(in);
        }
    }

    if (LOGGER.isLoggable(Level.FINEST)) {
        debugValues();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:38,代码来源:MemoryResultsSnapshot.java

示例8: onReceive

import java.io.DataInputStream; //导入方法依赖的package包/类
@Override
public void onReceive(int length, DataInputStream in) throws IOException {
    x = in.readDouble();
    y = in.readDouble();
    z = in.readDouble();
    yaw = in.readFloat();
    pitch = in.readFloat();
    onGround = in.readBoolean();
}
 
开发者ID:Clout-Team,项目名称:JarCraftinator,代码行数:10,代码来源:PacketPlayInPlayerPositionAndLook.java

示例9: parse

import java.io.DataInputStream; //导入方法依赖的package包/类
public static MouseClickAction parse(DataInputStream dis) throws IOException
{
	byte button = dis.readByte();
	boolean state = dis.readBoolean();
	
	return new MouseClickAction(button, state);
}
 
开发者ID:Elbehiry,项目名称:Pc-Control,代码行数:8,代码来源:MouseClickAction.java

示例10: read

import java.io.DataInputStream; //导入方法依赖的package包/类
@Override
public void read(DataInputStream input) throws IOException {
    super.read(input);
    
    boolean hasTitle = input.readBoolean();
    if(hasTitle) {
        getValue().setTitle(input.readUTF());
    }
    
    boolean hasAuthor = input.readBoolean();
    if(hasAuthor) {
        getValue().setAuthor(input.readUTF());
    }
    
    boolean hasGeneration = input.readBoolean();
    if(hasGeneration) {
        getValue().setGeneration(BookMeta.Generation.valueOf(input.readUTF()));
    }
    
    boolean hasPages = input.readBoolean();
    if(hasPages) {
        ArrayListStorage<StringStorage> pages = new ArrayListStorage<>(null);
        pages.read(input);
        
        getValue().setPages(pages.getValue().stream().map(StringStorage::getValue).collect(Collectors.toList()));
    }
}
 
开发者ID:OrigamiDream,项目名称:Leveled-Storage,代码行数:28,代码来源:BookMetaStorage.java

示例11: read

import java.io.DataInputStream; //导入方法依赖的package包/类
@Override
public void read(DataInputStream input) throws IOException {
    super.read(input);
    
    boolean hasEffect = input.readBoolean();
    if(hasEffect) {
        FireworkEffectStorage storage = new FireworkEffectStorage(null);
        storage.read(input);
        getValue().setEffect(storage.getValue());
    }
}
 
开发者ID:OrigamiDream,项目名称:Leveled-Storage,代码行数:12,代码来源:FireworkEffectMetaStorage.java

示例12: ModuleDataCache

import java.io.DataInputStream; //导入方法依赖的package包/类
public ModuleDataCache() {
    InputStream is = Stamps.getModulesJARs().asStream(CACHE);
    Map<String,byte[]> map = null;
    Map<String,Boolean> osgi = null;
    Map<String,String> cnbs = null;
    Set<String> toEn = null;
    List<String> toWi = null;
    int cnt = -1;
    char otherChar = File.separatorChar == '/' ? '\\' : '/';
    if (is != null) try {
        DataInputStream dis = new DataInputStream(is);
        
        String locale = dis.readUTF();
        String branding = dis.readUTF();
        
        if (!Locale.getDefault().toString().equals(locale)) {
            throw new IOException();
        }
        if (!branding.equals(nonNullBranding())) {
            throw new IOException();
        }
        
        map = new HashMap<String, byte[]>();
        osgi = new HashMap<String, Boolean>();
        cnbs = new HashMap<String, String>();
        cnt = dis.readInt();
        for (;;) {
            String path = Stamps.readRelativePath(dis).replace(otherChar, File.separatorChar);
            if (path.isEmpty()) {
                break;
            }
            boolean isOSGi = dis.readBoolean();
            osgi.put(path, isOSGi);
            cnbs.put(path, dis.readUTF());
            int len = dis.readInt();
            byte[] data = new byte[len];
            dis.readFully(data);
            map.put(path, data);
        }
        toEn = readCnbs(dis, new HashSet<String>());
        toWi = readCnbs(dis, new ArrayList<String>());
        dis.close();
    } catch (IOException ex) {
        Util.err.log(Level.FINE, "Cannot read " + Places.getCacheSubfile(CACHE), ex);
        map = null;
        osgi = null;
        cnbs = null;
        toEn = null;
        toWi = null;
    }
    path2Data = map;
    path2OSGi = osgi;
    path2Cnb = cnbs;
    toEnable = toEn;
    willEnable = toWi;
    moduleCount = cnt;
    if (map == null) {
        reset();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:61,代码来源:ModuleManager.java

示例13: readFromStream

import java.io.DataInputStream; //导入方法依赖的package包/类
public void readFromStream(DataInputStream in) throws IOException {
    super.readFromStream(in);
    
    StringCache strings = new StringCache();
    nProfiledSelects = in.readInt();
    selectNames = new String[nProfiledSelects];
    invocationsPerSelectId = new long[nProfiledSelects];
    timePerSelectId = new long[nProfiledSelects];
    typeForSelectId = new int[nProfiledSelects];
    commandTypeForSelectId = new int[nProfiledSelects];
    tablesForSelectId = new String[nProfiledSelects][];

    for (int i = 1; i < nProfiledSelects; i++) {
        selectNames[i] = in.readUTF();
        invocationsPerSelectId[i] = in.readLong();
        timePerSelectId[i] = in.readLong();
        typeForSelectId[i] = in.readInt();
        commandTypeForSelectId[i] = in.readInt();
        tablesForSelectId[i] = new String[in.readInt()];
        for (int j = 0; j < tablesForSelectId[i].length; j++) {
            tablesForSelectId[i][j] = strings.intern(in.readUTF());
        }
    }

    if (in.readBoolean()) {
        int len = in.readInt();
        //System.err.println("Read len: " +len);
        stacksForSelects = new RuntimeMemoryCCTNode[len];

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

            //System.err.println("  [" + i + "] = " + type);
            if (type != 0) {
                stacksForSelects[i] = RuntimeMemoryCCTNode.create(type);
                stacksForSelects[i].readFromStream(in);
            }
        }

        if (in.readBoolean()) {
            table = new JMethodIdTable();
            table.readFromStream(in);
        }
    }

    if (LOGGER.isLoggable(Level.FINEST)) {
        debugValues();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:50,代码来源:JdbcResultsSnapshot.java

示例14: read

import java.io.DataInputStream; //导入方法依赖的package包/类
@Override
public void read(DataInputStream stream) throws IOException{
	super.read(stream);
	open = stream.readBoolean();
}
 
开发者ID:Anuken,项目名称:Mindustry,代码行数:6,代码来源:Door.java

示例15: sendMessages

import java.io.DataInputStream; //导入方法依赖的package包/类
public void sendMessages(DataOutputStream dos, DataInputStream dis) throws IOException, InterruptedException
{
	byte[] msg = msgQueue.poll(5, TimeUnit.SECONDS);
	if( msg == null )
	{
		if( LOGGER.isDebugEnabled() )
		{
			LOGGER.debug(MessageFormat.format("Sending keepalive to NODE: {0}", receiverId));
		}
		dos.writeLong(-1);
		dos.flush();
		return;
	}

	boolean processed = false;
	try
	{
		dos.writeLong(headOffset);
		int msgSize = msg.length;
		dos.writeInt(msgSize);
		dos.write(msg);
		dos.flush();

		if( LOGGER.isTraceEnabled() )
		{
			LOGGER.trace(MessageFormat.format("Sending message to NODE: {0}", receiverId));
		}

		dis.readBoolean();

		synchronized( this )
		{
			totalQueueSize -= msgSize;
			headOffset++;
			processed = true;
		}
	}
	finally
	{
		if( !processed )
		{
			msgQueue.addFirst(msg);
		}
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:46,代码来源:MessageSender.java


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