You can now dump the black point for URLs to the pwd.

git-svn-id: https://zxing.googlecode.com/svn/trunk@954 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
dswitkin 2009-05-26 18:12:22 +00:00
parent 0a4e715ae4
commit 70eab118c1

View file

@ -170,7 +170,6 @@ public final class CommandLineRunner {
// Writes out a single PNG which is three times the width of the input image, containing from left
// to right: the original image, the row sampling monochrome version, and the 2D sampling
// monochrome version.
// TODO: Currently fails on URLs. Would be nice to handle gracefully and write the output to pwd.
private static void dumpBlackPoint(URI uri, BufferedImage image, MonochromeBitmapSource source) {
String inputName = uri.getPath();
if (inputName.contains(".mono.png")) {
@ -235,7 +234,14 @@ public final class CommandLineRunner {
BufferedImage result = new BufferedImage(stride, height, BufferedImage.TYPE_INT_ARGB);
result.setRGB(0, 0, stride, height, pixels, 0, stride);
// Use the current working directory for URLs
String resultName = inputName;
if (uri.getScheme().equals("http")) {
int pos = resultName.lastIndexOf('/');
if (pos > 0) {
resultName = "." + resultName.substring(pos);
}
}
int pos = resultName.lastIndexOf('.');
if (pos > 0) {
resultName = resultName.substring(0, pos);