public void putFloat(float f) throws IOException { int v = Float.floatToIntBits(f); putInt(v); }
public void putFloat(float f) throws IOException { int v = Float.floatToIntBits(f); putInt(v); }
void writeAttributes(BufferedByteWriter dos) throws IOException { dos.putInt(attributes.size()); for (Map.Entry<String, String> entry : attributes.entrySet()) { writeString(dos, entry.getKey()); writeString(dos, entry.getValue()); } }
void writeAttributes(BufferedByteWriter dos) throws IOException { dos.putInt(attributes.size()); for (Map.Entry<String, String> entry : attributes.entrySet()) { writeString(dos, entry.getKey()); writeString(dos, entry.getValue()); } }
public void writeTo(BufferedByteWriter fos) throws IOException { // File type fos.putNullTerminatedString(TDFTile.Type.variableStep.toString()); fos.putInt(tileStart); fos.putFloat((float)span); int nPositions = start.length; int nSamples = data.length; fos.putInt(nPositions); for (int i = 0; i < nPositions; i++) { fos.putInt(start[i]); } fos.putInt(nSamples); for (int i = 0; i < data.length; i++) { for (int j = 0; j < data[i].length; j++) { fos.putFloat(data[i][j]); } } }
public void writeTo(BufferedByteWriter fos) throws IOException { // File type fos.putNullTerminatedString(TDFTile.Type.variableStep.toString()); fos.putInt(tileStart); fos.putFloat((float) span); int nPositions = start.length; int nSamples = data.length; fos.putInt(nPositions); for (int i = 0; i < nPositions; i++) { fos.putInt(start[i]); } fos.putInt(nSamples); for (int i = 0; i < data.length; i++) { for (int j = 0; j < data[i].length; j++) { fos.putFloat(data[i][j]); } } }
private void writeIndexPosition(String file, long indexPosition, int nbytes) { try { RandomAccessFile raf = new RandomAccessFile(file, "rw"); raf.getChannel().position(indexPositionPosition); // Write as little endian BufferedByteWriter buffer = new BufferedByteWriter(); buffer.putLong(indexPosition); buffer.putInt(nbytes); raf.write(buffer.getBytes()); raf.close(); } catch (IOException ex) { ex.printStackTrace(); } }
private void writeIndexPosition(long indexPosition, int nbytes) { try { RandomAccessFile raf = new RandomAccessFile(file, "rw"); raf.getChannel().position(indexPositionPosition); // Write as little endian BufferedByteWriter buffer = new BufferedByteWriter(); buffer.putLong(indexPosition); buffer.putInt(nbytes); raf.write(buffer.getBytes()); raf.close(); } catch (IOException ex) { ex.printStackTrace(); } }
private void writeIndexPosition(long indexPosition, int nbytes) { try { RandomAccessFile raf = new RandomAccessFile(file, "rw"); raf.getChannel().position(indexPositionPosition); // Write as little endian BufferedByteWriter buffer = new BufferedByteWriter(); buffer.putLong(indexPosition); buffer.putInt(nbytes); raf.write(buffer.getBytes()); raf.close(); } catch (IOException ex) { ex.printStackTrace(); } }
public void writeTo(BufferedByteWriter fos) throws IOException { // File type TDFTile.Type type = names == null ? TDFTile.Type.bed : TDFTile.Type.bedWithName; fos.putNullTerminatedString(type.toString()); int nPositions = start.length; int nSamples = data.length; fos.putInt(nPositions); for (int i = 0; i < nPositions; i++) { fos.putInt(start[i]); } for (int i = 0; i < nPositions; i++) { fos.putInt(end[i]); } fos.putInt(nSamples); for (int i = 0; i < data.length; i++) { for (int j = 0; j < data[i].length; j++) { fos.putFloat(data[i][j]); } } // Optionally record feature names if (type == TDFTile.Type.bedWithName) { for (int i = 0; i < nPositions; i++) { fos.putNullTerminatedString(names[i]); } } }
public void writeTo(BufferedByteWriter fos) throws IOException { // File type TDFTile.Type type = names == null ? TDFTile.Type.bed : TDFTile.Type.bedWithName; fos.putNullTerminatedString(type.toString()); int nPositions = start.length; int nSamples = data.length; fos.putInt(nPositions); for (int i = 0; i < nPositions; i++) { fos.putInt(start[i]); } for (int i = 0; i < nPositions; i++) { fos.putInt(end[i]); } fos.putInt(nSamples); for (int i = 0; i < data.length; i++) { for (int j = 0; j < data[i].length; j++) { fos.putFloat(data[i][j]); } } // Optionally record feature names if (type == TDFTile.Type.bedWithName) { for (int i = 0; i < nPositions; i++) { fos.putNullTerminatedString(names[i]); } } }
private void writeIndex() throws IOException { BufferedByteWriter buffer = new BufferedByteWriter(); // Now write out dataset index buffer.putInt(datasetIndex.size()); for (Map.Entry<String, IndexEntry> entry : datasetIndex.entrySet()) { buffer.putNullTerminatedString(entry.getKey()); buffer.putLong(entry.getValue().position); buffer.putInt(entry.getValue().nBytes); } // group index log.info("Group idx: " + groupIndex.size()); buffer.putInt(groupIndex.size()); for (Map.Entry<String, IndexEntry> entry : groupIndex.entrySet()) { buffer.putNullTerminatedString(entry.getKey()); buffer.putLong(entry.getValue().position); buffer.putInt(entry.getValue().nBytes); } byte[] bytes = buffer.getBytes(); write(bytes); }
private void writeIndex() throws IOException { BufferedByteWriter buffer = new BufferedByteWriter(); // Now write out dataset index buffer.putInt(datasetIndex.size()); for (Map.Entry<String, IndexEntry> entry : datasetIndex.entrySet()) { buffer.putNullTerminatedString(entry.getKey()); buffer.putLong(entry.getValue().position); buffer.putInt(entry.getValue().nBytes); } // group index System.out.println("Group idx: " + groupIndex.size()); buffer.putInt(groupIndex.size()); for (Map.Entry<String, IndexEntry> entry : groupIndex.entrySet()) { buffer.putNullTerminatedString(entry.getKey()); buffer.putLong(entry.getValue().position); buffer.putInt(entry.getValue().nBytes); } byte[] bytes = buffer.getBytes(); write(bytes); }
private int writeIndex() throws IOException { // compress and write BufferedByteWriter buff = new BufferedByteWriter(); buff.putInt(chrPositionMap.size()); for (Map.Entry<String, IndexEntry> entry : chrPositionMap.entrySet()) { IndexEntry ie = entry.getValue(); buff.putNullTerminatedString(entry.getKey()); buff.putLong(ie.position); buff.putInt(ie.size); } byte[] bytes = buff.getBytes(); write(bytes); return bytes.length; }
public void writeTo(BufferedByteWriter fos) throws IOException { fos.putNullTerminatedString(TDFTile.Type.fixedStep.toString()); fos.putInt(getSize()); fos.putInt(start); fos.putFloat((float) span); for (int i = 0; i < data.length; i++) { for (int j = 0; j < data[i].length; j++) { fos.putFloat(data[i][j]); } } }
public void writeTo(BufferedByteWriter fos) throws IOException { fos.putNullTerminatedString(TDFTile.Type.fixedStep.toString()); fos.putInt(getSize()); fos.putInt(start); fos.putFloat((float)span); for (int i = 0; i < data.length; i++) { for (int j = 0; j < data[i].length; j++) { fos.putFloat(data[i][j]); } } }
public void write(BufferedByteWriter dos) throws IOException { writeAttributes(dos); writeString(dos, dataType.toString()); dos.putFloat(tileWidth); // dos.writeFloat(binWidth); dos.putInt(tilePositions.length); for (int i = 0; i < tilePositions.length; i++) { dos.putLong(tilePositions[i]); dos.putInt(tileSizes[i]); } }
public void write(BufferedByteWriter dos) throws IOException { writeAttributes(dos); writeString(dos, dataType.toString()); dos.putFloat(tileWidth); // dos.writeFloat(binWidth); dos.putInt(tilePositions.length); for (int i = 0; i < tilePositions.length; i++) { dos.putLong(tilePositions[i]); dos.putInt(tileSizes[i]); } }
private void writeHeader() throws IOException { // Magic number -- 4 bytes byte[] magicNumber = new byte[]{'E', 'Q', 'T', 'L'}; BufferedByteWriter buffer = new BufferedByteWriter(); buffer.put(magicNumber); buffer.putInt(version); // Reserve space for the master index pointer and byte count. // The actual values will be written at the end indexPositionPosition = buffer.bytesWritten(); buffer.putLong(0l); // File position for start of index buffer.putInt(0); // Size in bytes of index final byte[] bytes = buffer.getBytes(); write(bytes); }
public byte [] encodeBinary() throws IOException { BufferedByteWriter writer = new BufferedByteWriter(); writer.putNullTerminatedString(snp); writer.putNullTerminatedString(chr); writer.putInt(position); writer.putNullTerminatedString(geneId); writer.putNullTerminatedString(geneName); //writer.putFloat(tStat); writer.putFloat(pValue); //writer.putFloat(qValue); return writer.getBytes(); }