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


Java BinIO.storeObject方法代码示例

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


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

示例1: main

import it.unimi.dsi.fastutil.io.BinIO; //导入方法依赖的package包/类
public static void main(String[] arg) throws IOException, JSAPException {
	final SimpleJSAP jsap = new SimpleJSAP(GZIPIndexer.class.getName(), "Computes and stores a quasi-succinct index for a compressed archive.",
			new Parameter[] {
				new UnflaggedOption("archive", JSAP.STRING_PARSER, JSAP.REQUIRED, "The name a GZIP's archive."),
				new UnflaggedOption("index", JSAP.STRING_PARSER, JSAP.REQUIRED, "The output (a serialized LongBigList of pointers to the records in the archive) filename."),
			}
	);

	final JSAPResult jsapResult = jsap.parse(arg);
	if (jsap.messagePrinted()) return;

	final FastBufferedInputStream input = new FastBufferedInputStream(new FileInputStream(jsapResult.getString("archive")));
	ProgressLogger pl = new ProgressLogger(LOGGER, 1, TimeUnit.MINUTES, "records");
	pl.start("Scanning...");
	final EliasFanoMonotoneLongBigList list = new EliasFanoMonotoneLongBigList(index(input, pl));
	pl.done();
	BinIO.storeObject(list, jsapResult.getString("index"));
}
 
开发者ID:LAW-Unimi,项目名称:BUbiNG,代码行数:19,代码来源:GZIPIndexer.java

示例2: testTriple

import it.unimi.dsi.fastutil.io.BinIO; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testTriple() throws IOException, ClassNotFoundException {
	final String[] s = { "a", "b", "c" };
	ZFastTrie<String> zft = new ZFastTrie<>(Arrays.asList(s), TransformationStrategies.prefixFreeIso());
	for (int i = s.length; i-- != 0;)
		assertTrue(s[i], zft.contains(s[i]));
	final File temp = File.createTempFile(getClass().getSimpleName(), "test");
	temp.deleteOnExit();
	BinIO.storeObject(zft, temp);
	zft = (ZFastTrie<String>)BinIO.loadObject(temp);
	for (int i = s.length; i-- != 0;)
		assertTrue(zft.contains(s[i]));

	for (int i = s.length; i-- != 0;) {
		assertTrue(zft.remove(s[i]));
		assertFalse(zft.contains(s[i]));
	}
}
 
开发者ID:vigna,项目名称:Sux4J,代码行数:20,代码来源:ZFastTrieTest.java

示例3: testZipfianValuesGamma

import it.unimi.dsi.fastutil.io.BinIO; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testZipfianValuesGamma() throws IOException, ClassNotFoundException {
	for (final int size : new int[] { 100, 1000, 10000 }) {
		final String[] s = new String[size];
		for (int i = s.length; i-- != 0;)
			s[i] = Integer.toString(i);
		final XoRoShiRo128PlusRandomGenerator r = new XoRoShiRo128PlusRandomGenerator(0);
		final long[] values = new long[size];
		final ZipfDistribution z = new org.apache.commons.math3.distribution.ZipfDistribution(r, 100000, 2);
		for (int i = 0; i < size; i++) {
			values[i] = z.sample();
		}
		final Codec.Gamma cdc = new Codec.Gamma();
		GV3CompressedFunction<CharSequence> mph = new GV3CompressedFunction.Builder<CharSequence>().keys(Arrays.asList(s)).codec(cdc).transform(TransformationStrategies.utf16()).values(LongArrayList.wrap(values)).build();
		check(size, s, mph, values);
		final File temp = File.createTempFile(getClass().getSimpleName(), "test");
		temp.deleteOnExit();
		BinIO.storeObject(mph, temp);
		mph = (GV3CompressedFunction<CharSequence>) BinIO.loadObject(temp);
		check(size, s, mph, values);
	}

}
 
开发者ID:vigna,项目名称:Sux4J,代码行数:25,代码来源:GV3CompressedFunctionTest.java

示例4: testZipfianValuesLengthLimitedHuffman

import it.unimi.dsi.fastutil.io.BinIO; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testZipfianValuesLengthLimitedHuffman() throws IOException, ClassNotFoundException {
	for (final int size : new int[] { 100, 1000, 10000 }) {
		final String[] s = new String[size];
		for (int i = s.length; i-- != 0;)
			s[i] = Integer.toString(i);
		final XoRoShiRo128PlusRandomGenerator r = new XoRoShiRo128PlusRandomGenerator(0);
		final long[] values = new long[size];
		final ZipfDistribution z = new org.apache.commons.math3.distribution.ZipfDistribution(r, 100000, 2);
		for (int i = 0; i < size; i++) {
			values[i] = z.sample();
		}
		final Codec.Huffman cdc = new Codec.Huffman(6);
		GV3CompressedFunction<CharSequence> mph = new GV3CompressedFunction.Builder<CharSequence>().keys(Arrays.asList(s)).codec(cdc).transform(TransformationStrategies.utf16()).values(LongArrayList.wrap(values)).build();
		check(size, s, mph, values);
		final File temp = File.createTempFile(getClass().getSimpleName(), "test");
		temp.deleteOnExit();
		BinIO.storeObject(mph, temp);
		mph = (GV3CompressedFunction<CharSequence>) BinIO.loadObject(temp);
		check(size, s, mph, values);
	}

}
 
开发者ID:vigna,项目名称:Sux4J,代码行数:25,代码来源:GV3CompressedFunctionTest.java

示例5: testGeometricValuesLengthLimitedHuffman

import it.unimi.dsi.fastutil.io.BinIO; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testGeometricValuesLengthLimitedHuffman() throws IOException, ClassNotFoundException {
	for (final int size : new int[] { 100, 1000, 10000 }) {
		final String[] s = new String[size];
		for (int i = s.length; i-- != 0;)
			s[i] = Integer.toString(i);
		final XoRoShiRo128PlusRandom r = new XoRoShiRo128PlusRandom(0);
		final long[] values = new long[size];
		for (int i = 0; i < size; i++) {
			values[i] = Integer.numberOfTrailingZeros(r.nextInt());
		}
		final Codec.Huffman cdc = new Codec.Huffman(5);
		GV3CompressedFunction<CharSequence> mph = new GV3CompressedFunction.Builder<CharSequence>().keys(Arrays.asList(s)).codec(cdc).transform(TransformationStrategies.utf16()).values(LongArrayList.wrap(values)).build();
		check(size, s, mph, values);
		final File temp = File.createTempFile(getClass().getSimpleName(), "test");
		temp.deleteOnExit();
		BinIO.storeObject(mph, temp);
		mph = (GV3CompressedFunction<CharSequence>) BinIO.loadObject(temp);
		check(size, s, mph, values);
	}

}
 
开发者ID:vigna,项目名称:Sux4J,代码行数:24,代码来源:GV3CompressedFunctionTest.java

示例6: testGammaValues

import it.unimi.dsi.fastutil.io.BinIO; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testGammaValues() throws IOException, ClassNotFoundException {
	for (final int size : new int[] { 100, 1000, 10000 }) {
		final String[] s = new String[size];
		for (int i = s.length; i-- != 0;) s[i] = Integer.toString(i);
		final long[] values = new long[size];
		generateGamma(values);
		GV3CompressedFunction<CharSequence> mph = new GV3CompressedFunction.Builder<CharSequence>().keys(Arrays.asList(s)).codec(new Codec.Huffman(20)).transform(TransformationStrategies.utf16()).values(LongArrayList.wrap(values)).build();
		check(size, s, mph, values);
		final File temp = File.createTempFile(getClass().getSimpleName(), "test");
		temp.deleteOnExit();
		BinIO.storeObject(mph, temp);
		mph = (GV3CompressedFunction<CharSequence>) BinIO.loadObject(temp);
		check(size, s, mph, values);
	}
}
 
开发者ID:vigna,项目名称:Sux4J,代码行数:18,代码来源:GV3CompressedFunctionTest.java

示例7: testDoubleton

import it.unimi.dsi.fastutil.io.BinIO; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testDoubleton() throws IOException, ClassNotFoundException {
	final String[] s = { "a", "c" };
	ZFastTrie<String> zft = new ZFastTrie<>(Arrays.asList(s), TransformationStrategies.prefixFreeIso());
	for (int i = s.length; i-- != 0;)
		assertTrue(s[i], zft.contains(s[i]));
	final File temp = File.createTempFile(getClass().getSimpleName(), "test");
	temp.deleteOnExit();
	BinIO.storeObject(zft, temp);
	zft = (ZFastTrie<String>)BinIO.loadObject(temp);
	for (int i = s.length; i-- != 0;)
		assertTrue(zft.contains(s[i]));

	for (int i = s.length; i-- != 0;) {
		assertTrue(zft.remove(s[i]));
		assertFalse(zft.contains(s[i]));
	}
}
 
开发者ID:vigna,项目名称:Sux4J,代码行数:20,代码来源:ZFastTrieTest.java

示例8: testUniformNumbers

import it.unimi.dsi.fastutil.io.BinIO; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testUniformNumbers() throws IOException, ClassNotFoundException {
	// TODO: restore working codec for size 1
	for (final int maxLength : new int[] { 2, 3, 4, 8, 16, 32, 64 }) {
		for (final int size : new int[] { 0, 1000, 10000 }) {
			final String[] s = new String[size];

			for (int i = s.length; i-- != 0;) s[i] = Integer.toString(i);
			final XoRoShiRo128PlusRandom r = new XoRoShiRo128PlusRandom(0);
			final long[] v = new long[size];
			for (int i = 0; i < size; i++) v[i] = r.nextInt(maxLength);
			final Codec codec = new Codec.Huffman();
			GV4CompressedFunction<CharSequence> mph = new GV4CompressedFunction.Builder<CharSequence>().keys(Arrays.asList(s)).codec(codec).transform(TransformationStrategies.utf16()).values(LongArrayList.wrap(v)).build();
			check(size, s, mph, v);
			final File temp = File.createTempFile(getClass().getSimpleName(), "test");
			temp.deleteOnExit();
			BinIO.storeObject(mph, temp);
			mph = (GV4CompressedFunction<CharSequence>) BinIO.loadObject(temp);

			check(size, s, mph, v);

		}
	}
}
 
开发者ID:vigna,项目名称:Sux4J,代码行数:26,代码来源:GV4CompressedFunctionTest.java

示例9: main

import it.unimi.dsi.fastutil.io.BinIO; //导入方法依赖的package包/类
public static void main(String[] arg) throws IOException {
	if (arg.length == 0) {
		System.err.println("Usage: " + BuildRepetitionSet.class.getSimpleName() + " REPETITIONSET");
		System.exit(1);
	}

	final FastBufferedReader fastBufferedReader = new FastBufferedReader(new InputStreamReader(System.in, Charsets.US_ASCII));
	final MutableString s = new MutableString();
	final LongOpenHashSet repeatedSet = new LongOpenHashSet();
	final String outputFilename = arg[0];
	final ProgressLogger pl = new ProgressLogger();

	MutableString lastUrl = new MutableString();
	pl.itemsName = "lines";
	pl.start("Reading... ");
	while(fastBufferedReader.readLine(s) != null) {
		final int firstTab = s.indexOf('\t');
		final int secondTab = s.indexOf('\t', firstTab + 1);
		MutableString url = s.substring(secondTab + 1);
		if (url.equals(lastUrl)) {
			final int storeIndex = Integer.parseInt(new String(s.array(), 0, firstTab));
			final long storePosition = Long.parseLong(new String(s.array(), firstTab + 1, secondTab - firstTab - 1));
			repeatedSet.add((long)storeIndex << 48 | storePosition);
			System.out.print(storeIndex);
			System.out.print('\t');
			System.out.print(storePosition);
			System.out.print('\t');
			System.out.println(url);
		}

		lastUrl = url;
		pl.lightUpdate();
	}

	pl.done();

	fastBufferedReader.close();
	BinIO.storeObject(repeatedSet, outputFilename);
}
 
开发者ID:LAW-Unimi,项目名称:BUbiNG,代码行数:40,代码来源:BuildRepetitionSet.java

示例10: main

import it.unimi.dsi.fastutil.io.BinIO; //导入方法依赖的package包/类
public static void main( String args[] ) throws JSAPException, IOException {
    SimpleJSAP jsap = new SimpleJSAP( UncompressedWordVectors.class.getName(), "Creates a Word Vector representation from a string file", new Parameter[]{ new FlaggedOption( "input", JSAP.STRING_PARSER, JSAP
            .NO_DEFAULT, JSAP.REQUIRED, 'i', "input", "Vector file" ), new FlaggedOption( "output", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, 'o', "output", "Output file name" ) } );
    JSAPResult jsapResult = jsap.parse( args );
    if( jsap.messagePrinted() ) return;
    UncompressedWordVectors vec = UncompressedWordVectors.read( jsapResult.getString( "input" ) );
    vec.N = vec.vectors.get( vec.vectors.keySet().iterator().next() ).length;
    BinIO.storeObject( vec, jsapResult.getString( "output" ) );
}
 
开发者ID:yahoo,项目名称:FEL,代码行数:10,代码来源:UncompressedWordVectors.java

示例11: testNumbers

import it.unimi.dsi.fastutil.io.BinIO; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testNumbers() throws IOException, ClassNotFoundException {
	for (int size : new int[] { 0, 1, 4, 8, 20, 64, 100, 1000 }) {
		System.err.println("Size: " + size);

		String[] s = new String[size];
		long[] v = new long[s.length];
		for (int i = s.length; i-- != 0;)
			s[(int)(v[i] = i)] = Integer.toString(i);

		GOV3Function<String> function = new GOV3Function.Builder<String>().keys(Arrays.asList(s)).transform(TransformationStrategies.utf16()).values(LongArrayList.wrap(v), 12).build();

		for (int i = s.length; i-- != 0;)
			assertEquals(i, function.getLong(s[i]));

		File temp = File.createTempFile(getClass().getSimpleName(), "test");
		temp.deleteOnExit();
		BinIO.storeObject(function, temp);
		function = (GOV3Function<String>)BinIO.loadObject(temp);
		for (int i = s.length; i-- != 0;)
			assertEquals(i, function.getLong(s[i]));

		function = new GOV3Function.Builder<String>().keys(Arrays.asList(s)).transform(TransformationStrategies.utf16()).build();
		for (int i = s.length; i-- != 0;)
			assertEquals(i, function.getLong(s[i]));
	}
}
 
开发者ID:vigna,项目名称:Sux4J,代码行数:29,代码来源:HypergraphFunctionTest.java

示例12: testNumbers

import it.unimi.dsi.fastutil.io.BinIO; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testNumbers() throws IOException, ClassNotFoundException {

	for (final int size : new int[] { 0, 1, 4, 8, 20, 64, 100, 1000, 10000, 100000, 1000000 }) {
		for(final int signatureWidth: new int[] { 0, 32, 64 }) {
			System.err.println("Size: " + size  + " w: " + signatureWidth);
			final String[] s = new String[size];
			for (int i = s.length; i-- != 0;)
				s[i] = Integer.toString(i);

			CHDMinimalPerfectHashFunction<CharSequence> mph = new Builder<CharSequence>().keys(Arrays.asList(s)).transform(TransformationStrategies.utf16()).signed(signatureWidth).build();

			check(size, s, mph, signatureWidth);

			final File temp = File.createTempFile(getClass().getSimpleName(), "test");
			temp.deleteOnExit();
			BinIO.storeObject(mph, temp);
			mph = (CHDMinimalPerfectHashFunction<CharSequence>)BinIO.loadObject(temp);

			check(size, s, mph, signatureWidth);

			// From store
			final ChunkedHashStore<CharSequence> chunkedHashStore = new ChunkedHashStore<>(TransformationStrategies.utf16(), null, signatureWidth < 0 ? -signatureWidth : 0, null);
			chunkedHashStore.addAll(Arrays.asList(s).iterator());
			chunkedHashStore.checkAndRetry(Arrays.asList(s));
			mph = new CHDMinimalPerfectHashFunction.Builder<CharSequence>().store(chunkedHashStore).signed(signatureWidth).build();
			chunkedHashStore.close();

			check(size, s, mph, signatureWidth);
		}
	}
}
 
开发者ID:vigna,项目名称:Sux4J,代码行数:34,代码来源:CHDMinimalPerfectHashFunctionTest.java

示例13: main

import it.unimi.dsi.fastutil.io.BinIO; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public static void main(final String[] arg) throws IOException, JSAPException, ClassNotFoundException {
	final SimpleJSAP jsap = new SimpleJSAP(SignedFunctionStringMap.class.getName(), "Saves a string map wrapping a signed function on character sequences.",
			new Parameter[] {
		new UnflaggedOption("function", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, JSAP.NOT_GREEDY, "The filename of a signed function defined on character sequences."),
		new UnflaggedOption("map", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, JSAP.NOT_GREEDY, "The filename of the resulting string map."),
	});

	final JSAPResult jsapResult = jsap.parse(arg);
	if (jsap.messagePrinted()) return;

	final String functionName = jsapResult.getString("function");
	final String mapName = jsapResult.getString("map");
	BinIO.storeObject(new SignedFunctionStringMap((Object2LongFunction<? extends CharSequence>)BinIO.loadObject(functionName)), mapName);
}
 
开发者ID:vigna,项目名称:Sux4J,代码行数:16,代码来源:SignedFunctionStringMap.java

示例14: testUniformBinary

import it.unimi.dsi.fastutil.io.BinIO; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testUniformBinary() throws IOException, ClassNotFoundException {
	// TODO: restore working codec for size 1
	for (final int maxLength : new int[] { 2, 3, 4, 8, 16, 32, 64 }) {
		for (final int size : new int[] { 0, 1000, 10000 }) {
			final String[] s = new String[size];

			for (int i = s.length; i-- != 0;)
				s[i] = Integer.toString(i);
			final XoRoShiRo128PlusRandom r = new XoRoShiRo128PlusRandom(0);
			final long[] v = new long[size];
			for (int i = 0; i < size; i++) v[i] = r.nextInt(maxLength);
			final Codec codec = new Codec.Binary();
			final LongArrayList values = LongArrayList.wrap(v);
			GV3CompressedFunction<CharSequence> mph = new GV3CompressedFunction.Builder<CharSequence>().keys(Arrays.asList(s)).codec(codec).transform(TransformationStrategies.utf16()).values(values).build();
			check(size, s, mph, v);
			final File temp = File.createTempFile(getClass().getSimpleName(), "test");
			temp.deleteOnExit();
			BinIO.storeObject(mph, temp);
			mph = (GV3CompressedFunction<CharSequence>) BinIO.loadObject(temp);

			check(size, s, mph, v);

		}
	}
}
 
开发者ID:vigna,项目名称:Sux4J,代码行数:28,代码来源:GV3CompressedFunctionTest.java

示例15: testNumbers

import it.unimi.dsi.fastutil.io.BinIO; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testNumbers() throws IOException, ClassNotFoundException {

	for (final int size : new int[] { 0, 1, 4, 8, 20, 64, 100, 1000, 10000, 100000 }) {
		for(final int signatureWidth: new int[] { 0, 32, 64 }) {
			System.err.println("Size: " + size  + " w: " + signatureWidth);
			final String[] s = new String[size];
			for (int i = s.length; i-- != 0;)
				s[i] = Integer.toString(i);

			MinimalPerfectHashFunction<CharSequence> mph = new Builder<CharSequence>().keys(Arrays.asList(s)).transform(TransformationStrategies.utf16()).signed(signatureWidth).build();

			check(size, s, mph, signatureWidth);

			final File temp = File.createTempFile(getClass().getSimpleName(), "test");
			temp.deleteOnExit();
			BinIO.storeObject(mph, temp);
			mph = (MinimalPerfectHashFunction<CharSequence>)BinIO.loadObject(temp);

			check(size, s, mph, signatureWidth);

			// From store
			final ChunkedHashStore<CharSequence> chunkedHashStore = new ChunkedHashStore<>(TransformationStrategies.utf16(), null, signatureWidth < 0 ? -signatureWidth : 0, null);
			chunkedHashStore.addAll(Arrays.asList(s).iterator());
			chunkedHashStore.checkAndRetry(Arrays.asList(s));
			mph = new MinimalPerfectHashFunction.Builder<CharSequence>().store(chunkedHashStore).signed(signatureWidth).build();
			chunkedHashStore.close();

			check(size, s, mph, signatureWidth);
		}
	}
}
 
开发者ID:vigna,项目名称:Sux4J,代码行数:34,代码来源:MinimalPerfectHashFunctionTest.java


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