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


Java ArrayUtil.EMPTY_SHORT_ARRAY属性代码示例

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


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

示例1: initChunkLengthTable

private synchronized void initChunkLengthTable() throws IOException {
  if (myChunkLengthTable != null) return;
  File chunkLengthFile = getChunkLengthFile();

  if (chunkLengthFile.exists()) {
    final DataInputStream chunkLengthStream = new DataInputStream(new BufferedInputStream(
      new LimitedInputStream(new FileInputStream(chunkLengthFile), (int)chunkLengthFile.length()) {
        @Override
        public int available() throws IOException {
          return remainingLimit();
        }
      }, 32768));
    try{
      short[] chunkLengthTable = new short[(int)(chunkLengthFile.length() / 2)];
      int chunkLengthTableLength = 0;

      long o = 0;
      while (chunkLengthStream.available() != 0) {
        int chunkLength = DataInputOutputUtil.readINT(chunkLengthStream);
        o += chunkLength;
        if (chunkLengthTableLength == chunkLengthTable.length) {
          chunkLengthTable = reallocShortTable(chunkLengthTable);
        }
        chunkLengthTable[chunkLengthTableLength++] = (short)chunkLength;
        if (doDebug) myCompressedChunksFileOffsets.add(o);
      }
      myChunkLengthTable = chunkLengthTable;
      myChunkTableLength = chunkLengthTableLength;

      if (myChunkTableLength >= FACTOR) {
        long[] chunkOffsetTable = new long[myChunkTableLength / FACTOR];
        long offset = 0;
        for(int i = 0; i < chunkOffsetTable.length; ++i) {
          int start = i * FACTOR;
          for(int j = 0; j < FACTOR; ++j) {
            offset += (chunkLengthTable[start + j] & MAX_PAGE_LENGTH);
          }
          chunkOffsetTable[i] = offset;
        }
        myChunkOffsetTable = chunkOffsetTable;
        if (doDebug) { // check all offsets
          for(int i = 0; i < chunkLengthTableLength; ++i) {
            calcOffsetOfPage(i);
          }
        }
      } else {
        myChunkOffsetTable = ArrayUtil.EMPTY_LONG_ARRAY;
      }

      myFileLength = calcOffsetOfPage(myChunkTableLength - 1);
    } finally {
      try {
        chunkLengthStream.close();
      } catch (IOException ignore) {}
    }
  }
  else {
    myChunkLengthTable = ArrayUtil.EMPTY_SHORT_ARRAY;
    myChunkTableLength = 0;
    myChunkOffsetTable = ArrayUtil.EMPTY_LONG_ARRAY;
    myFileLength = 0;
  }

  if (myUncompressedFileLength == -1) {
    long tempFileLength = getIncompleteChunkFile().length();
    myUncompressedFileLength = ((long)myChunkTableLength * myAppendBufferLength) + tempFileLength;
    if (myUncompressedFileLength != myFileLength + tempFileLength) {
      if (CompressionUtil.DUMP_COMPRESSION_STATS) {
        System.out.println(myUncompressedFileLength + "->" + (myFileLength + tempFileLength) + " for " + myBaseFile);
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:73,代码来源:CompressedAppendableFile.java


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