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


Java DataInputStream.readUnsignedByte方法代码示例

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


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

示例1: loadVerificationTypeInfo

import java.io.DataInputStream; //导入方法依赖的package包/类
static VerificationTypeInfo loadVerificationTypeInfo(DataInputStream in, ConstantPool pool) 
  throws IOException {
    int tag = in.readUnsignedByte();
    switch (tag) {
        case ITEM_Top: return new TopVariableInfo();
        case ITEM_Integer: return new IntegerVariableInfo();
        case ITEM_Float: return new FloatVariableInfo();
        case ITEM_Long: return new LongVariableInfo();
        case ITEM_Double: return new DoubleVariableInfo();
        case ITEM_Null: return new NullVariableInfo();
        case ITEM_UninitializedThis: return new UninitializedThisVariableInfo();
        case ITEM_Object: {
            int cpool_index = in.readUnsignedShort();
            return new ObjectVariableInfo(pool.get(cpool_index));
        }
        case ITEM_Uninitialized: {
            int offset = in.readUnsignedShort();
            return new UninitializedVariableInfo(offset);
        }
        default:
            throw new InvalidClassFormatException("invalid verification_type_info tag: " + tag);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:VerificationTypeInfo.java

示例2: readHexNumberingBlock

import java.io.DataInputStream; //导入方法依赖的package包/类
/**
 * Read in information on hex sheets which define the hex numbering systems. This represents supplemental
 * information--some map sheet info occurs earlier in the file.  Only the coordinates of the top-left corner
 * are read in here.
 */
protected void readHexNumberingBlock(DataInputStream in) throws IOException {
  ADC2Utils.readBlockHeader(in, "Hex Numbering");

  for (int i = 0; i < mapSheets.size()+1; ++i) {
    // rare case when integers are not base-250. However, they are big-endian despite being a
    // Windows application.
    int col = 0;
    for (int j = 0; j < 4; ++j) {
      col <<= 8;
      col += in.readUnsignedByte();
    }
    int row = 0;
    for (int j = 0; j < 4; ++j) {
      row <<= 8;
      row += in.readUnsignedByte();
    }
    if (i < mapSheets.size()) {
      MapSheet ms = mapSheets.get(i);
      ms.setTopLeftCol(col);
      ms.setTopLeftRow(row);
    }
  }
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:29,代码来源:MapBoard.java

示例3: prepareInputBuffer

import java.io.DataInputStream; //导入方法依赖的package包/类
public void prepareInputBuffer(DataInputStream in, int len)
        throws IOException {
    if (len < INIT_SIZE)
        throw new CorruptedInputException();

    if (in.readUnsignedByte() != 0x00)
        throw new CorruptedInputException();

    code = in.readInt();
    range = 0xFFFFFFFF;

    // Read the data to the end of the buffer. If the data is corrupt
    // and the decoder, reading from buf, tries to read past the end of
    // the data, ArrayIndexOutOfBoundsException will be thrown and
    // the problem is detected immediately.
    len -= INIT_SIZE;
    pos = buf.length - len;
    in.readFully(buf, pos, len);
}
 
开发者ID:dbrant,项目名称:zimdroid,代码行数:20,代码来源:RangeDecoderFromBuffer.java

示例4: readHexDataBlock

import java.io.DataInputStream; //导入方法依赖的package包/类
/**
 * Read primary and secondary symbol information. Each hex may only have one of each. Additional symbols must
 * be tertiary attributes.
 */
protected void readHexDataBlock(DataInputStream in) throws IOException {
  ADC2Utils.readBlockHeader(in, "Hex Data");

  int count = getNColumns() * getNRows();

  for (int i = 0; i < count; ++i) {
    // primary symbol
    int symbolIndex = ADC2Utils.readBase250Word(in);
    SymbolSet.SymbolData symbol = getSet().getMapBoardSymbol(symbolIndex);
    if (symbol != null)
      primaryMapBoardSymbols.add(new HexData(i, symbol));

    // secondary symbol
    symbolIndex = ADC2Utils.readBase250Word(in);
    symbol = getSet().getMapBoardSymbol(symbolIndex);
    if (symbol != null)
      secondaryMapBoardSymbols.add(new HexData(i, symbol));

    /* int elevation = */ ADC2Utils.readBase250Word(in);

    // flags for hexsides, lines, and placenames: completely ignored
    /* int additionalInformation = */ in.readUnsignedByte();
  }
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:29,代码来源:MapBoard.java

示例5: readName

import java.io.DataInputStream; //导入方法依赖的package包/类
private static String readName(DataInputStream dis, byte[] data) throws IOException {
    int c = dis.readUnsignedByte();
    if ((c & 192) == 192) {
        c = ((c & 63) << 8) + dis.readUnsignedByte();
        HashSet<Integer> jumps = new HashSet();
        jumps.add(Integer.valueOf(c));
        return readName(data, c, jumps);
    } else if (c == 0) {
        return "";
    } else {
        byte[] b = new byte[c];
        dis.readFully(b);
        String s = IDN.toUnicode(new String(b));
        String t = readName(dis, data);
        if (t.length() > 0) {
            return s + "." + t;
        }
        return s;
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:21,代码来源:DnsMessage.java

示例6: RangeDecoderFromStream

import java.io.DataInputStream; //导入方法依赖的package包/类
public RangeDecoderFromStream(InputStream in) throws IOException {
    inData = new DataInputStream(in);

    if (inData.readUnsignedByte() != 0x00)
        throw new CorruptedInputException();

    code = inData.readInt();
    range = 0xFFFFFFFF;
}
 
开发者ID:dbrant,项目名称:zimdroid,代码行数:10,代码来源:RangeDecoderFromStream.java

示例7: readInt

import java.io.DataInputStream; //导入方法依赖的package包/类
private static int readInt(DataInputStream dis) throws IOException {
    int byte1 = dis.readUnsignedByte();
    int byte2 = dis.readUnsignedByte();
    int byte3 = dis.readUnsignedByte();
    int byte4 = dis.readUnsignedByte();
    return (byte1 + (byte2 << 8) + (byte3 << 16) + (byte4 << 24));
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:8,代码来源:NBSDecoder.java

示例8: readDiceBlock

import java.io.DataInputStream; //导入方法依赖的package包/类
protected void readDiceBlock(DataInputStream in) throws IOException {
  ADC2Utils.readBlockHeader(in, "Dice");

  /* boolean autoRevealWhenMoving = */ in.readByte();
  in.readByte(); // unknown
  /* int ndice = */ in.readUnsignedByte();
  /* int nsides = */ in.readUnsignedByte();
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:9,代码来源:ADC2Module.java

示例9: readFlipDefinitionBlock

import java.io.DataInputStream; //导入方法依赖的package包/类
protected void readFlipDefinitionBlock(DataInputStream in) throws IOException {
  ADC2Utils.readBlockHeader(in, "Flip Definition");

  in.readUnsignedByte(); // unknown byte

  nFlipDefs = ADC2Utils.readBase250Word(in);
for (int i = 0; i < nFlipDefs; ++i) {
    int from = ADC2Utils.readBase250Word(in);
    int to = ADC2Utils.readBase250Word(in);
    if (from >= 0 && from < pieceClasses.size() && to >= 0 && to < pieceClasses.size()) {
      pieceClasses.get(from).setFlipClass(to);
      pieceClasses.get(to).setBackFlipClass(from);
    }
  }
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:16,代码来源:ADC2Module.java

示例10: readFacingBlock

import java.io.DataInputStream; //导入方法依赖的package包/类
protected void readFacingBlock(DataInputStream in) throws IOException {
  ADC2Utils.readBlockHeader(in, "Facing");

  final int nFacing = in.readUnsignedByte();
  allowedFacings = new FacingDirection[nFacing+1];
  allowedFacings[0] = FacingDirection.NONE;

  for (int i = 0; i < nFacing; ++i) {
    /* String styleName = */ readNullTerminatedString(in);

    int direction = in.readUnsignedByte();
    // one invalid facing struct will invalidate all later ones.
    if (i == 0 || allowedFacings[i] != FacingDirection.NONE) {
      switch (direction) {
      case 2:
        allowedFacings[i+1] = FacingDirection.VERTEX;
        break;
      case 3:
        allowedFacings[i+1] = FacingDirection.BOTH;
        break;
      default:
        allowedFacings[i+1] = FacingDirection.FLAT_SIDES;
      }
    }
    else {
      allowedFacings[i+1] = FacingDirection.NONE;
    }

    // this describes how the arrow is drawn in ADC2
    /* int display = */ in.readUnsignedByte();
    /* int fillColor = */ in.readUnsignedByte();
    /* int outlineColor = */ in.readUnsignedByte();
    // zoom sizes
    in.readFully(new byte[3]);
  }
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:37,代码来源:ADC2Module.java

示例11: readCombatSummaryBlock

import java.io.DataInputStream; //导入方法依赖的package包/类
protected void readCombatSummaryBlock(DataInputStream in) throws IOException {
  ADC2Utils.readBlockHeader(in, "Fast Zoom");

  /* int fastZoom = */ in.readUnsignedByte();
  classCombatSummaryValues = in.readUnsignedByte();
  pieceCombatSummaryValues = in.readUnsignedByte();
  /* int fastDraw = */ in.readUnsignedByte();
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:9,代码来源:ADC2Module.java

示例12: readPlayerBlock

import java.io.DataInputStream; //导入方法依赖的package包/类
protected void readPlayerBlock(DataInputStream in) throws IOException {
  ADC2Utils.readBlockHeader(in, "Player");

  // file format doesn't actually care how many players it says there is.
  /* int nplayers = */ ADC2Utils.readBase250Word(in);

  // The last player is typically an empty string which indicates the end of
  // the list despite the fact that the number of players is clearly
  // indicated.
  String name;
  do {
    name = readNullTerminatedString(in, 25);
    // someday we may try to crack this, but since it doesn't actually encrypt anything
    // there's no real point.
    // byte[] password = new byte[20];
    in.readFully(new byte[20]);
    /* int startingZoomLevel = */ in.readByte();
    /* int startingPosition = */ ADC2Utils.readBase250Word(in);
    SymbolSet.SymbolData hiddenSymbol = getSet().getGamePiece(ADC2Utils.readBase250Word(in));
    /* String picture = */ readNullTerminatedString(in);

    // we don't do anything with this.
    /* int searchRange = */ in.readUnsignedByte();

    int hiddenPieceOptions = in.readUnsignedByte();
    in.readByte(); // padding

    if (name.length() > 0) {
      Player player = new Player(name, hiddenSymbol, hiddenPieceOptions);
      players.add(player);
    }
  } while (name.length() > 0);
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:34,代码来源:ADC2Module.java

示例13: readShort

import java.io.DataInputStream; //导入方法依赖的package包/类
private static short readShort(DataInputStream dis) throws IOException {
    int byte1 = dis.readUnsignedByte();
    int byte2 = dis.readUnsignedByte();
    return (short) (byte1 + (byte2 << 8));
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:6,代码来源:NBSDecoder.java

示例14: readPlaceNameBlock

import java.io.DataInputStream; //导入方法依赖的package包/类
/**
 * Optional labels that can be added to hexes.  Can also include a symbol that can be added with the label.
 */
protected void readPlaceNameBlock(DataInputStream in) throws IOException {
  ADC2Utils.readBlockHeader(in, "Place Name");

  int nNames = ADC2Utils.readBase250Word(in);
  for (int i = 0; i < nNames; ++i) {
    int index = ADC2Utils.readBase250Word(in);
    // extra hex symbol
    SymbolSet.SymbolData symbol = getSet().getMapBoardSymbol(ADC2Utils.readBase250Word(in));
    if (symbol != null && isOnMapBoard(index))
      placeSymbols.add(new HexData(index, symbol));
    String text = readNullTerminatedString(in, 25);
    Color color = ADC2Utils.getColorFromIndex(in.readUnsignedByte());

    int size = 0;
    for (int z = 0; z < 3; ++z) {
      int b = in.readUnsignedByte();
      if (z == zoomLevel)
        size = b;
    }

    PlaceNameOrientation orientation = null;
    for (int z = 0; z < 3; ++z) {
      int o = in.readByte();
      if (z == zoomLevel) {
        switch (o) {
        case 1:
          orientation = PlaceNameOrientation.LOWER_CENTER;
          break;
        case 2:
          orientation = PlaceNameOrientation.UPPER_CENTER;
          break;
        case 3:
          orientation = PlaceNameOrientation.LOWER_RIGHT;
          break;
        case 4:
          orientation = PlaceNameOrientation.UPPER_RIGHT;
          break;
        case 5:
          orientation = PlaceNameOrientation.UPPER_LEFT;
          break;
        case 6:
          orientation = PlaceNameOrientation.LOWER_LEFT;
          break;
        case 7:
          orientation = PlaceNameOrientation.CENTER_LEFT;
          break;
        case 8:
          orientation = PlaceNameOrientation.CENTER_RIGHT;
          break;
        case 9:
          orientation = PlaceNameOrientation.HEX_CENTER;
          break;
        }
      }
    }

    int font = in.readUnsignedByte();

    if (!isOnMapBoard(index) || text.length() == 0 || orientation == null)
      continue;

    placeNames.add(new PlaceName(index, text, color, orientation, size, font));
  }
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:68,代码来源:MapBoard.java

示例15: readAnnotationElementValue

import java.io.DataInputStream; //导入方法依赖的package包/类
/**
 * Read annotation element value from classfile.
 */
// --------------------------------CreditEase Modified START----------------------------
private void readAnnotationElementValue(final DataInputStream inp, final Object[] constantPool) throws Exception {

    // --------------------------------CreditEase Modified END----------------------------
    final int tag = inp.readUnsignedByte();
    switch (tag) {
        case 'B':
        case 'C':
        case 'D':
        case 'F':
        case 'I':
        case 'J':
        case 'S':
        case 'Z':
        case 's':
            // const_value_index
            inp.skipBytes(2);
            break;
        case 'e':
            // enum_const_value
            inp.skipBytes(4);
            break;
        case 'c':
            // class_info_index
            inp.skipBytes(2);
            break;
        case '@':
            // Complex (nested) annotation
            readAnnotation(inp, constantPool);
            break;
        case '[':
            // array_value
            final int count = inp.readUnsignedShort();
            for (int l = 0; l < count; ++l) {
                // Nested annotation element value
                readAnnotationElementValue(inp, constantPool);
            }
            break;
        default:
            // System.err.println("Invalid annotation element type tag: 0x" + Integer.toHexString(tag));
            break;
    }
}
 
开发者ID:uavorg,项目名称:uavstack,代码行数:47,代码来源:ClassGraphBuilder.java


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