• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ByteArrays类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中it.unimi.dsi.fastutil.bytes.ByteArrays的典型用法代码示例。如果您正苦于以下问题:Java ByteArrays类的具体用法?Java ByteArrays怎么用?Java ByteArrays使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ByteArrays类属于it.unimi.dsi.fastutil.bytes包,在下文中一共展示了ByteArrays类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: extend

import it.unimi.dsi.fastutil.bytes.ByteArrays; //导入依赖的package包/类
private Set<byte[]> extend(final byte[] lhs, final byte[] rhs) {
  final Set<byte[]> extendedRhsCandidates =
      new ObjectOpenCustomHashSet<>(ByteArrays.HASH_STRATEGY);
  if (lhs.length + rhs.length > this.level - 1) {
    // extended candidates would have more columns than this level allows,
    // return empty extended candidates
    return extendedRhsCandidates;
  }
  for (final byte[] singleColumn : this.singleColumnPermutations) {
    if (ByteArrayPermutations.disjoint(singleColumn, lhs)
        && ByteArrayPermutations.disjoint(singleColumn, rhs)) {
      extendedRhsCandidates.add(ByteArrayPermutations.join(rhs, singleColumn));
    }
  }
  return extendedRhsCandidates;
}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:17,代码来源:ORDERLhsRhs.java


示例2: append

import it.unimi.dsi.fastutil.bytes.ByteArrays; //导入依赖的package包/类
public void append(byte b) {
    if (size >= bytes.length - 1) {
        bytes = ByteArrays.grow(bytes, bytes.length + 1024);
    }
    switch (b) {
        case -1:
            bytes[size++] = -1;
            bytes[size++] = MINUS_CODE;
            break;
        case (byte) '\n':
            bytes[size++] = -1;
            bytes[size++] = NL_CODE;
            break;
        case (byte) '\r':
            bytes[size++] = -1;
            bytes[size++] = RETURN_CODE;
            break;
        default:
            bytes[size++] = b;
    }

}
 
开发者ID:scaled-ml,项目名称:Scaled-ML,代码行数:23,代码来源:LineBytesBuffer.java


示例3: buildPrefixBlocks

import it.unimi.dsi.fastutil.bytes.ByteArrays; //导入依赖的package包/类
private void buildPrefixBlocks() {
  this.prefixBlocks = new Object2ObjectOpenCustomHashMap<>(ByteArrays.HASH_STRATEGY);

  for (final byte[] permutation : this.previousLevelCandidates) {
    // prefix is the emtpy array for permutations of size 1 (level 1)
    final byte[] prefix = ByteArrayPermutations.prefix(permutation);

    if (this.prefixBlocks.get(prefix) == null) {
      this.prefixBlocks.put(prefix, new ArrayList<byte[]>());
    }
    this.prefixBlocks.get(prefix).add(permutation);
  }
}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:14,代码来源:ORDERLhsRhs.java


示例4: initializePartitions

import it.unimi.dsi.fastutil.bytes.ByteArrays; //导入依赖的package包/类
protected void initializePartitions() throws AlgorithmExecutionException {
  this.permutationToPartition = new Object2ObjectOpenCustomHashMap<>(ByteArrays.HASH_STRATEGY);

  // create partitions for level 1
  for (final int columnIndex : this.columnIndices) {
    final byte[] singleColumnPermutation = {(byte) columnIndex};

    final SortedPartition partition =
        SortedPartitionCreator.createPartition(this.dataByColumns.get(columnIndex),
            this.types.get(columnIndex));

    this.permutationToPartition.put(singleColumnPermutation, partition);
  }

}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:16,代码来源:ORDER.java


示例5: wrap

import it.unimi.dsi.fastutil.bytes.ByteArrays; //导入依赖的package包/类
/** Wraps a byte-array fragment into this byte-array character sequence.
 *
 * @param b a byte array.
 * @param offset the first valid byte in <code>b</code>.
 * @param length the number of valid bytes in <code>b</code>, starting at <code>offset</code>.
 * @return this byte-array character sequence.
 */
public ByteArrayCharSequence wrap(final byte[] b, int offset, int length) {
	ByteArrays.ensureOffsetLength(b, offset, length);
	this.b = b;
	this.offset = offset;
	this.length = length;
	return this;
}
 
开发者ID:LAW-Unimi,项目名称:BUbiNG,代码行数:15,代码来源:ByteArrayCharSequence.java


示例6: dequeue

import it.unimi.dsi.fastutil.bytes.ByteArrays; //导入依赖的package包/类
/** Dequeues an object from the queue in FIFO fashion. */
@SuppressWarnings("unchecked")
public synchronized T dequeue() throws IOException {
	final int length = byteDiskQueue.dequeueInt();
	fbaos.array = ByteArrays.grow(fbaos.array, length);
	byteDiskQueue.dequeue(fbaos.array, 0, length);
	size--;
	try {
		return (T)BinIO.loadObject(new FastByteArrayInputStream(fbaos.array, 0, length));
	}
	catch (final ClassNotFoundException e) {
		throw new RuntimeException(e.getMessage(), e);
	}
}
 
开发者ID:LAW-Unimi,项目名称:BUbiNG,代码行数:15,代码来源:ObjectDiskQueue.java


示例7: readLineFrom

import it.unimi.dsi.fastutil.bytes.ByteArrays; //导入依赖的package包/类
public boolean readLineFrom(FastBufferedInputStream stream) throws IOException {
    int start = 0, len;
    while ((len = stream.readLine(bytes, start, bytes.length - start)) == bytes.length - start) {
        start += len;
        bytes = ByteArrays.grow(bytes, bytes.length + 1024);
    }
    size = start + Math.max(len, 0);
    return !(size == 0 && len < 0);
}
 
开发者ID:scaled-ml,项目名称:Scaled-ML,代码行数:10,代码来源:LineBytesBuffer.java


示例8: generateNextLevel

import it.unimi.dsi.fastutil.bytes.ByteArrays; //导入依赖的package包/类
private void generateNextLevel() {

    long time = System.currentTimeMillis();

    this.previousLevelCandidates = this.levelCandidates;
    this.levelCandidates = new ArrayList<>();

    this.buildPrefixBlocks();

    System.gc();

    this.logger.debug("PREFIX_BLOCKS in level {}: {} ", this.level, this.prettyPrintPrefixBlocks());

    for (final List<byte[]> candidatesWithSamePrefix : this.prefixBlocks.values()) {
      if (candidatesWithSamePrefix.size() < 2) {
        break;
      }
      for (final byte[] candidate : candidatesWithSamePrefix) {
        for (final byte[] candidateForJoin : candidatesWithSamePrefix) {
          if (Arrays.equals(candidate, candidateForJoin)) {
            continue;
          }

          final byte[] joinedCandidate = ByteArrayPermutations.join(candidate, candidateForJoin);
          this.levelCandidates.add(joinedCandidate);
        }
      }
    }
    this.logger.debug("Generated level {}", this.level + 1);
    this.logger.debug("Level {} candidates: {}", (this.level + 1),
        ByteArrayPermutations.permutationListToIntegerString(this.levelCandidates));
    if (this.level > 1 && !this.levelCandidates.isEmpty()) {
      for (final byte[] newLhs : this.previousLevelCandidates) {
        this.logger
            .debug(
                "After generating level {}. Adding {} as an lhs to the candidate set for the next level.",
                this.level + 1, ByteArrayPermutations.permutationToIntegerString(newLhs));
        this.currentRhsCandidateSet.put(newLhs, new ObjectOpenCustomHashSet<byte[]>(
            ByteArrays.HASH_STRATEGY));
      }
    }

    time = System.currentTimeMillis() - time;
    this.statistics.setGenNextTime(this.statistics.getGenNextTime() + time);

  }
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:47,代码来源:ORDERLhsRhs.java


示例9: ByteArrayCharSequence

import it.unimi.dsi.fastutil.bytes.ByteArrays; //导入依赖的package包/类
/** Creates a new empty byte-array character sequence.
 */
public ByteArrayCharSequence() {
	this(ByteArrays.EMPTY_ARRAY);
}
 
开发者ID:LAW-Unimi,项目名称:BUbiNG,代码行数:6,代码来源:ByteArrayCharSequence.java


示例10: sortAscending

import it.unimi.dsi.fastutil.bytes.ByteArrays; //导入依赖的package包/类
@Override
public void sortAscending() {
    ByteArrays.mergeSort(data.elements());
}
 
开发者ID:jtablesaw,项目名称:tablesaw,代码行数:5,代码来源:BooleanColumn.java


示例11: sortDescending

import it.unimi.dsi.fastutil.bytes.ByteArrays; //导入依赖的package包/类
@Override
public void sortDescending() {
    ByteArrays.mergeSort(data.elements(), reverseByteComparator);
}
 
开发者ID:jtablesaw,项目名称:tablesaw,代码行数:5,代码来源:BooleanColumn.java


示例12: trim

import it.unimi.dsi.fastutil.bytes.ByteArrays; //导入依赖的package包/类
/** Ensures that the length of the backing array is equal to {@link #length}. */
public void trim() {
	array = ByteArrays.trim( array, length );
}
 
开发者ID:phishman3579,项目名称:fastutil,代码行数:5,代码来源:FastByteArrayOutputStream.java


示例13: write

import it.unimi.dsi.fastutil.bytes.ByteArrays; //导入依赖的package包/类
public void write( final int b ) {
	if ( position >= array.length ) array = ByteArrays.grow( array, position + 1, length );
	array[ position++ ] = (byte)b;
	if ( length < position ) length = position;
}
 
开发者ID:phishman3579,项目名称:fastutil,代码行数:6,代码来源:FastByteArrayOutputStream.java


示例14: FileLinesList

import it.unimi.dsi.fastutil.bytes.ByteArrays; //导入依赖的package包/类
/** Creates a file-lines collection for the specified filename with the specified encoding, buffer size and terminator set.
 *
 * @param filename a filename.
 * @param encoding an encoding.
 * @param bufferSize the buffer size for {@link FastBufferedInputStream}.
 * @param terminators a set of line terminators.
 */
public FileLinesList(final CharSequence filename, final String encoding, final int bufferSize, final EnumSet<FastBufferedInputStream.LineTerminator> terminators) throws IOException {
	this.bufferSize = bufferSize;
	this.terminators = terminators;
	this.filename = filename.toString();

	inputStream = new FastBufferedInputStream(new FileInputStream(this.filename), bufferSize);
	decoder = (charset = Charset.forName(encoding)).newDecoder();
	byte[] array = new byte[16];
	int count = 0, start, len;

	for(;;) {
		start = 0;
		while((len = inputStream.readLine(array, start, array.length - start, terminators)) == array.length - start) {
			start += len;
			array = ByteArrays.grow(array, array.length + 1);
		};

		if (len != -1) count++;
		else break;
	}

	size = count;
	byteBuffer = ByteBuffer.wrap(array);
	charBuffer = CharBuffer.wrap(new char[array.length]);

	inputStream.position(0);
	borders = new EliasFanoMonotoneLongBigList(count, inputStream.length(), new LongIterator() {
		long pos = 0;
		byte[] buffer = byteBuffer.array();

		@Override
		public boolean hasNext() {
			return pos < size;
		}

		@Override
		public long nextLong() {
			if (! hasNext()) throw new NoSuchElementException();
			pos++;
			try {
				final long result = inputStream.position();
				inputStream.readLine(buffer, terminators);
				return result;
			}
			catch (final IOException e) {
				throw new RuntimeException(e);
			}
		}
	});
}
 
开发者ID:vigna,项目名称:Sux4J,代码行数:58,代码来源:FileLinesList.java


示例15: FileLinesBigList

import it.unimi.dsi.fastutil.bytes.ByteArrays; //导入依赖的package包/类
/** Creates a file-lines collection for the specified filename with the specified encoding, buffer size and terminator set.
 *
 * @param filename a filename.
 * @param encoding an encoding.
 * @param bufferSize the buffer size for {@link FastBufferedInputStream}.
 * @param terminators a set of line terminators.
 */
public FileLinesBigList(final CharSequence filename, final String encoding, final int bufferSize, final EnumSet<FastBufferedInputStream.LineTerminator> terminators) throws IOException {
	this.bufferSize = bufferSize;
	this.terminators = terminators;
	this.filename = filename.toString();

	inputStream = new FastBufferedInputStream(new FileInputStream(this.filename), bufferSize);
	decoder = (charset = Charset.forName(encoding)).newDecoder();
	byte[] array = new byte[16];
	long count = 0;
	int start, len;

	for(;;) {
		start = 0;
		while((len = inputStream.readLine(array, start, array.length - start, terminators)) == array.length - start) {
			start += len;
			array = ByteArrays.grow(array, array.length + 1);
		};

		if (len != -1) count++;
		else break;
	}

	size = count;
	byteBuffer = ByteBuffer.wrap(array);
	charBuffer = CharBuffer.wrap(new char[array.length]);

	inputStream.position(0);
	borders = new EliasFanoMonotoneLongBigList(count, inputStream.length(), new LongIterator() {
		long pos = 0;
		byte[] buffer = byteBuffer.array();

		@Override
		public boolean hasNext() {
			return pos < size;
		}

		@Override
		public long nextLong() {
			if (! hasNext()) throw new NoSuchElementException();
			pos++;
			try {
				final long result = inputStream.position();
				inputStream.readLine(buffer, terminators);
				return result;
			}
			catch (final IOException e) {
				throw new RuntimeException(e);
			}
		}
	});
}
 
开发者ID:vigna,项目名称:Sux4J,代码行数:59,代码来源:FileLinesBigList.java


示例16: setContentOf

import it.unimi.dsi.fastutil.bytes.ByteArrays; //导入依赖的package包/类
public void setContentOf(LineBytesBuffer feature) {
    size = feature.size;
    bytes = ByteArrays.ensureCapacity(bytes, size);
    System.arraycopy(feature.bytes, 0, bytes, 0, size);
}
 
开发者ID:scaled-ml,项目名称:Scaled-ML,代码行数:6,代码来源:LineBytesBuffer.java



注:本文中的it.unimi.dsi.fastutil.bytes.ByteArrays类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MvpBasePresenter类代码示例发布时间:2022-05-23
下一篇:
Java TitledSeparator类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap