public static void writeSingleHits( IntBP positions, FloatBP weights, IntBP las, String prefix, int chrom) throws IOException { String postmp = getPositionsFname(prefix, chrom) + ".tmp"; String weightstmp = getWeightsFname(prefix, chrom) + ".tmp"; String lastmp = getLaSFname(prefix, chrom) + ".tmp"; RandomAccessFile positionsRAF = new RandomAccessFile(postmp, "rw"); RandomAccessFile weightsRAF = new RandomAccessFile(weightstmp, "rw"); RandomAccessFile lasRAF = new RandomAccessFile(lastmp, "rw"); Bits.sendBytes(positions.bb, 0, positions.bb.limit(), positionsRAF.getChannel()); Bits.sendBytes(weights.bb, 0, weights.bb.limit(), weightsRAF.getChannel()); Bits.sendBytes(las.bb, 0, las.bb.limit(), lasRAF.getChannel()); positionsRAF.close(); weightsRAF.close(); lasRAF.close(); /* ideally this part with the renames would atomic... */ (new File(postmp)).renameTo(new File(getPositionsFname(prefix, chrom))); (new File(weightstmp)).renameTo(new File(getWeightsFname(prefix, chrom))); (new File(lastmp)).renameTo(new File(getLaSFname(prefix, chrom))); }