Example usage for javax.imageio.stream FileImageOutputStream writeInt

List of usage examples for javax.imageio.stream FileImageOutputStream writeInt

Introduction

In this page you can find the example usage for javax.imageio.stream FileImageOutputStream writeInt.

Prototype

public void writeInt(int v) throws IOException 

Source Link

Usage

From source file:de.hpi.fgis.hdrs.node.Index.java

private void writeMeta() throws IOException {
    File metaFile = new File(indexRoot.getAbsolutePath() + File.separator + METAFILE);
    if (metaFile.isFile()) {
        if (!metaFile.delete()) {
            throw new IOException("Cannot delete old meta file for index " + order);
        }/*  w  ww.  jav a  2 s. c  o m*/
    }
    FileImageOutputStream out = new FileImageOutputStream(metaFile);
    out.writeInt(segments.size());
    for (SegmentInfo info : segments) {
        info.write(out);
    }
    out.close();
}

From source file:de.hpi.fgis.hdrs.node.Node.java

private void writeSegmentIdCounter() {
    try {//  ww w .j  a va 2s  .c o  m
        File f = new File(rootDir.getAbsolutePath() + File.separator + SEGMENT_ID_COUNTER_FILE);
        if (f.isFile()) {
            if (!f.delete()) {
                throw new IOException("Cannot delete old index meta file");
            }
        }
        FileImageOutputStream out = new FileImageOutputStream(f);
        out.writeInt(segmentIdCounter);
        out.close();
    } catch (IOException ex) {
        LOG.error("Error writing store meta file", ex);
    }
}