WorldFileWriter { private void write(BufferedWriter writer, MathTransform transform){ try { if ((transform instanceof IdentityTransform)) { writer.write("1"); writer.newLine(); writer.write("0"); writer.newLine(); writer.write("0"); writer.newLine(); writer.write("1"); writer.newLine(); writer.write("0"); writer.newLine(); writer.write("0"); close(writer); return; } if ((transform instanceof AffineTransform2D)) { final AffineTransform2D affine = (AffineTransform2D) transform; writer.write(Double.toString(affine.getScaleX())); writer.newLine(); writer.write(Double.toString(affine.getShearX())); writer.newLine(); writer.write(Double.toString(affine.getShearY())); writer.newLine(); writer.write(Double.toString(affine.getScaleY())); writer.newLine(); writer.write(Double.toString(affine.getTranslateX())); writer.newLine(); writer.write(Double.toString(affine.getTranslateY())); close(writer); return; } assert false:transform; } catch (IOException e) { if(LOGGER.isLoggable(Level.SEVERE)) LOGGER.log(Level.SEVERE,e.getLocalizedMessage(),e); } finally { close(writer); } } WorldFileWriter(final File outLocation,
			final AffineTransform transform);  WorldFileWriter(final File outLocation,
			final AffineTransform transform, final int buffSize);  WorldFileWriter(final OutputStream outLocation,
			final AffineTransform transform);  WorldFileWriter(final OutputStream outLocation,
			final AffineTransform transform, final int buffSize);  WorldFileWriter(final OutputStream outLocation,
			final MathTransform transform);  WorldFileWriter(final OutputStream outLocation,
			final MathTransform transform, final int buffSize);  WorldFileWriter(final File outLocation, final MathTransform transform, int buffSize);  WorldFileWriter(final File outLocation, final MathTransform transform);  static final int DEFAULT_BUFFER_SIZE; }
@Test public void testWrite() throws Exception { AffineTransform at = new AffineTransform(42.34, 0, 0, -42.34,347671.10, 5196940.18); File tmp = File.createTempFile("write", "wld", new File("target")); new WorldFileWriter(tmp, at); BufferedReader r = new BufferedReader(new FileReader(tmp)); assertEquals(42.34, Double.parseDouble(r.readLine()), 0.1); assertEquals(0, Double.parseDouble(r.readLine()), 0.1); assertEquals(0, Double.parseDouble(r.readLine()), 0.1); assertEquals(-42.34, Double.parseDouble(r.readLine()), 0.1); assertEquals(347671.10, Double.parseDouble(r.readLine()), 0.1); assertEquals(5196940.18, Double.parseDouble(r.readLine()), 0.1); assertNull(r.readLine()); }