|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectit.unipi.di.util.Utils
public abstract class Utils
Utility class with a variety of multi-purpose static methods.
Method Summary | |
---|---|
static int |
bytesToInt(byte[] array)
|
static long |
bytesToLong(byte[] array)
|
static String |
elapsedTime(long msecs)
|
static String |
elapsedTime(long start,
long stop)
|
static int |
fastUnzip(byte[] input,
it.unimi.dsi.mg4j.io.FastByteArrayOutputStream out)
Read the input byte array compressed with ZIP and uncompress it using a previously allocated FastByteArrayOutputStream . |
static int |
fastUnzip(byte[] input,
int offset,
int size,
it.unimi.dsi.mg4j.io.FastByteArrayOutputStream out)
Read the input byte array compressed with ZIP and uncompress it using a previously allocated FastByteArrayOutputStream . |
static void |
fastZip(byte[] input,
int off,
int len,
it.unimi.dsi.mg4j.io.FastByteArrayOutputStream out,
int level)
Compress with ZIP using the JCraft library. |
static String |
formatSize(long size)
|
static it.unimi.dsi.mg4j.util.MutableString |
getField(it.unimi.dsi.mg4j.util.MutableString rec,
int field,
it.unimi.dsi.mg4j.util.MutableString fieldSeparator)
|
static String |
getKey(String line,
int[] cols,
char sep,
boolean numeric)
|
static long |
getLong(byte[] buff,
int pos)
|
static String |
getSortingCols(String line,
int[] fields,
Pattern p)
|
static byte[] |
intToBytes(int val)
|
static byte[] |
loadFromDisk(String file)
A fast way to load in memory the content of a file. |
static byte[] |
longToBytes(long val)
|
static byte[] |
merge(byte[] b1,
byte[] b2)
|
static String |
pad(String str)
|
static double |
round(double val,
int precision)
|
static String |
trimLeftZeros(String str)
|
static byte[] |
zip(byte[] input,
int off,
int len)
Deprecated. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static double round(double val, int precision)
public static String formatSize(long size)
public static String elapsedTime(long start, long stop)
public static String elapsedTime(long msecs)
public static byte[] intToBytes(int val)
public static byte[] longToBytes(long val)
public static byte[] merge(byte[] b1, byte[] b2)
public static long bytesToLong(byte[] array)
public static int bytesToInt(byte[] array)
public static int fastUnzip(byte[] input, it.unimi.dsi.mg4j.io.FastByteArrayOutputStream out) throws IOException
FastByteArrayOutputStream
.
The implementation is based on the JCraft ZLib implementation.
input
- the compressed dataout
- the output buffer
IOException
public static int fastUnzip(byte[] input, int offset, int size, it.unimi.dsi.mg4j.io.FastByteArrayOutputStream out) throws IOException
FastByteArrayOutputStream
.
The implementation is based on the JCraft ZLib implementation.
input
- the compressed dataoffset
- the starting position on the input arraysize
- the number of bytes to consider of the input arrayout
- the output buffer (reset by this method)
IOException
public static void fastZip(byte[] input, int off, int len, it.unimi.dsi.mg4j.io.FastByteArrayOutputStream out, int level) throws IOException
IOException
public static byte[] zip(byte[] input, int off, int len)
fastZip(byte[], int, int, FastByteArrayOutputStream, int)
public static byte[] loadFromDisk(String file) throws IOException
file
- the file to load
IOException
public static String getSortingCols(String line, int[] fields, Pattern p)
public static String trimLeftZeros(String str)
public static String getKey(String line, int[] cols, char sep, boolean numeric)
public static String pad(String str)
public static long getLong(byte[] buff, int pos)
public static it.unimi.dsi.mg4j.util.MutableString getField(it.unimi.dsi.mg4j.util.MutableString rec, int field, it.unimi.dsi.mg4j.util.MutableString fieldSeparator)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |