/** * Writes the given string followed by a newline character. * * @param s the line of text to be written. A newline does not * need to be appended, as this method automatically writes * a newline character. * @throws IOException if writing is not possible */ public void writeLine(String s) throws IOException { writeBytes(s); writeBytes("\n"); }
/** Writes the given string followed by a newline character. */ public void writeLine(String s) throws IOException { writeBytes(s); writeBytes("\n"); }
@Override public void saveRevision(String revision) throws IOException { saveStream.writeInt(revision.length()); saveStream.writeBytes(revision); }
/** Write the atom length and type. */ private void writeAtom(int length, String type) throws IOException { out.writeInt(length); out.writeBytes(type); }
@Override public void saveReleaseVersion(String version) throws IOException { saveStream.writeInt(version.length()); saveStream.writeBytes(version); }
/** Write the atom length and type. */ private void writeAtom(int length, String type) throws IOException { out.writeInt(length); out.writeBytes(type); }
@Override public void saveReleaseVersion(String version) throws IOException { saveStream.writeInt(version.length()); saveStream.writeBytes(version); }
@Override public void saveRevision(String revision) throws IOException { saveStream.writeInt(revision.length()); saveStream.writeBytes(revision); }
protected void writePlane(String varName, byte[] array, int w, int h) throws IOException { int i = 0; out.writeLine(" public byte[][] " + varName + " = {"); for (int y=0; y<h; y++) { out.writeBytes(" {"); for (int x=0; x<w; x++) { out.writeBytes(String.valueOf(array[i++])); if (x < w - 1) out.writeBytes(", "); else out.writeBytes("}"); } if (y < h - 1) out.writeLine(","); else out.writeLine(""); } out.writeLine(" };"); out.writeLine(""); }
protected void writePlane(String varName, double[] array, int w, int h) throws IOException { int i = 0; out.writeLine(" public double[][] " + varName + " = {"); for (int y=0; y<h; y++) { out.writeBytes(" {"); for (int x=0; x<w; x++) { out.writeBytes(String.valueOf(array[i++])); if (x < w - 1) out.writeBytes(", "); else out.writeBytes("}"); } if (y < h - 1) out.writeLine(","); else out.writeLine(""); } out.writeLine(" };"); out.writeLine(""); }
protected void writePlane(String varName, short[] array, int w, int h) throws IOException { int i = 0; out.writeLine(" public short[][] " + varName + " = {"); for (int y=0; y<h; y++) { out.writeBytes(" {"); for (int x=0; x<w; x++) { out.writeBytes(String.valueOf(array[i++])); if (x < w - 1) out.writeBytes(", "); else out.writeBytes("}"); } if (y < h - 1) out.writeLine(","); else out.writeLine(""); } out.writeLine(" };"); out.writeLine(""); }
protected void writePlane(String varName, double[] array, int w, int h) throws IOException { int i = 0; out.writeLine(" public double[][] " + varName + " = {"); for (int y=0; y<h; y++) { out.writeBytes(" {"); for (int x=0; x<w; x++) { out.writeBytes(String.valueOf(array[i++])); if (x < w - 1) out.writeBytes(", "); else out.writeBytes("}"); } if (y < h - 1) out.writeLine(","); else out.writeLine(""); } out.writeLine(" };"); out.writeLine(""); }
protected void writePlane(String varName, short[] array, int w, int h) throws IOException { int i = 0; out.writeLine(" public short[][] " + varName + " = {"); for (int y=0; y<h; y++) { out.writeBytes(" {"); for (int x=0; x<w; x++) { out.writeBytes(String.valueOf(array[i++])); if (x < w - 1) out.writeBytes(", "); else out.writeBytes("}"); } if (y < h - 1) out.writeLine(","); else out.writeLine(""); } out.writeLine(" };"); out.writeLine(""); }
protected void writePlane(String varName, int[] array, int w, int h) throws IOException { int i = 0; out.writeLine(" public int[][] " + varName + " = {"); for (int y=0; y<h; y++) { out.writeBytes(" {"); for (int x=0; x<w; x++) { out.writeBytes(String.valueOf(array[i++])); if (x < w - 1) out.writeBytes(", "); else out.writeBytes("}"); } if (y < h - 1) out.writeLine(","); else out.writeLine(""); } out.writeLine(" };"); out.writeLine(""); }
protected void writePlane(String varName, long[] array, int w, int h) throws IOException { int i = 0; out.writeLine(" public long[][] " + varName + " = {"); for (int y=0; y<h; y++) { out.writeBytes(" {"); for (int x=0; x<w; x++) { out.writeBytes(String.valueOf(array[i++])); if (x < w - 1) out.writeBytes(", "); else out.writeBytes("}"); } if (y < h - 1) out.writeLine(","); else out.writeLine(""); } out.writeLine(" };"); out.writeLine(""); }
protected void writePlane(String varName, int[] array, int w, int h) throws IOException { int i = 0; out.writeLine(" public int[][] " + varName + " = {"); for (int y=0; y<h; y++) { out.writeBytes(" {"); for (int x=0; x<w; x++) { out.writeBytes(String.valueOf(array[i++])); if (x < w - 1) out.writeBytes(", "); else out.writeBytes("}"); } if (y < h - 1) out.writeLine(","); else out.writeLine(""); } out.writeLine(" };"); out.writeLine(""); }
protected void writePlane(String varName, float[] array, int w, int h) throws IOException { int i = 0; out.writeLine(" public float[][] " + varName + " = {"); for (int y=0; y<h; y++) { out.writeBytes(" {"); for (int x=0; x<w; x++) { out.writeBytes(String.valueOf(array[i++])); if (x < w - 1) out.writeBytes(", "); else out.writeBytes("}"); } if (y < h - 1) out.writeLine(","); else out.writeLine(""); } out.writeLine(" };"); out.writeLine(""); }
@Override public void close() throws IOException { if (out != null) { out.writeBytes(xmlFragments.get(xmlFragments.size() - 1)); } if (getMetadataOptions().isValidate()) { try { MetadataRetrieve r = getMetadataRetrieve(); String omexml = service.getOMEXML(r); service.validateOMEXML(omexml); } catch (ServiceException | NullPointerException e) { LOGGER.warn("OMEXMLService unable to create OME-XML metadata object.", e); } } super.close(); xmlFragments = null; service = null; }
@Override public void close() throws IOException { if (out != null) { out.writeBytes(xmlFragments.get(xmlFragments.size() - 1)); } if (getMetadataOptions().isValidate()) { try { MetadataRetrieve r = getMetadataRetrieve(); String omexml = service.getOMEXML(r); service.validateOMEXML(omexml); } catch (ServiceException | NullPointerException e) { LOGGER.warn("OMEXMLService unable to create OME-XML metadata object.", e); } } super.close(); xmlFragments = null; service = null; }
private void writeFooter() throws IOException { footerPointer = out.getFilePointer(); // write IEND chunk out.writeInt(0); out.writeBytes("IEND"); out.writeInt(crc("IEND".getBytes(Constants.ENCODING))); // update frame count out.seek(numFramesPointer); out.writeInt(numFrames); out.skipBytes(4); byte[] b = new byte[12]; b[0] = 'a'; b[1] = 'c'; b[2] = 'T'; b[3] = 'L'; DataTools.unpackBytes(numFrames, b, 4, 4, false); DataTools.unpackBytes(0, b, 8, 4, false); out.writeInt(crc(b)); }