All Downloads are FREE. Search and download functionalities are using the official Maven repository.

src.it.unimi.dsi.io.package.html Maven / Gradle / Ivy

Go to download

The DSI utilities are a mishmash of classes accumulated during the last twenty years in projects developed at the DSI (Dipartimento di Scienze dell'Informazione, i.e., Information Sciences Department), now DI (Dipartimento di Informatica, i.e., Informatics Department), of the Universita` degli Studi di Milano.

There is a newer version: 2.7.3
Show newest version


  
    I/O classes
  

  

    

I/O classes.

Package Specification

Classes in this package fulfill needs that are not satisfied by the I/O classes available.

Reading text

We provide replacement classes such as {@link it.unimi.dsi.io.FastBufferedReader} and classes exposing the lines of a file as a {@linkplain it.unimi.dsi.io.FileLinesCollection collection} or as an {@linkplain it.unimi.dsi.io.LineIterator iterator}. The general {@link it.unimi.dsi.io.WordReader} interface is used by MG4J to provide customisable word segmentation.

Bit-level I/O

The standard Java API lacks bit-level I/O classes: to this purpose, we provide {@link it.unimi.dsi.io.InputBitStream} and {@link it.unimi.dsi.io.OutputBitStream}, which can wrap any standard Java corresponding stream and make it work at the bit level; moreover, they provide support for several useful formats (such as unary, binary, minimal binary, γ, δ and Golomb encoding).

Bit input and output streams offer also efficient buffering and a way to reposition the bit stream in case the underlying byte stream is a file-based stream or a {@link it.unimi.dsi.fastutil.io.RepositionableStream}.

Conventions

All coding methods work on natural numbers. The encoding of zero is very natural for some techniques, and much less natural for others. To keep methods rationally organised, all methods are able to encode any natural number. If, for instance, you want to write positive numbers in unary encoding and you do not want to waste a bit, you have to decrement them first (i.e., instead of p you must encode p−1).





© 2015 - 2024 Weber Informatics LLC | Privacy Policy