List of usage examples for org.apache.hadoop.io WritableUtils getVIntSize
public static int getVIntSize(long i)
From source file:org.terrier.compression.integer.ByteOutputStream.java
License:Mozilla Public License
@Override public int writeVInt(int x) throws IOException { int bytes = WritableUtils.getVIntSize(x); WritableUtils.writeVInt(dos, x);/*from w w w . j a va2s . c o m*/ byteOffset += bytes; return bytes; }
From source file:org.terrier.compression.integer.ByteOutputStream.java
License:Mozilla Public License
@Override public int writeVLong(long x) throws IOException { int bytes = WritableUtils.getVIntSize(x); WritableUtils.writeVLong(dos, x);//from w ww . j a v a 2 s. co m byteOffset += bytes; return bytes; }
From source file:org.terrier.compression.integer.ByteOutputStream.java
License:Mozilla Public License
@Override public int getVSize(long x) { return WritableUtils.getVIntSize(x); }
From source file:org.terrier.structures.seralization.FixedSizeTextFactory.java
License:Mozilla Public License
/** For the Hadoop Text class, given a String of charCount, how long * is the maximum encoded bytes?/*from www . j av a 2 s.com*/ * @param charCount maximum length of the String * @return maximum number of bytes */ public static int getMaximumTextLength(int charCount) { return WritableUtils.getVIntSize(charCount) + 3 * charCount; }
From source file:shuffle.DummyDataGenerator.java
License:Apache License
@Override public void run() throws Exception { KeyValuesWriter kvWriter = (KeyValuesWriter) (getOutputs().values().iterator().next().getWriter()); long size = 1100 * 1024 * 1024; System.out.println("Size : " + size); long recordNo = 0; while (size > 0) { LongWritable key = new LongWritable(recordNo); Text val = new Text(RandomStringUtils.random(100)); kvWriter.write(key, val); size -= (val.getLength() + WritableUtils.getVIntSize(recordNo)); }// ww w . j a v a2 s. com }