/** * Read the contents from the inputStream and place into a String, * with any error messages put in the return String. * Assume UTF-8 encoding. * * @param is the inputStream to read from. * @return String holding the contents, or an error message. * @throws java.io.IOException on io error */ static public String readContents(InputStream is) throws IOException { return readContents(is, "UTF-8"); }
/** * Read the contents from the inputStream and place into a String, * with any error messages put in the return String. * Assume UTF-8 encoding. * * @param is the inputStream to read from. * @return String holding the contents, or an error message. * @throws java.io.IOException on io error */ static public String readContents(InputStream is) throws IOException { return readContents(is, "UTF-8"); }
/** * Read the contents from the inputStream and place into a String, * with any error messages put in the return String. * Assume UTF-8 encoding. * * @param is the inputStream to read from. * @return String holding the contents, or an error message. * @throws java.io.IOException on io error */ static public String readContents(InputStream is) throws IOException { return readContents(is, "UTF-8"); }
System.out.println(" PointConfig URL = <" + resourceLocation + ">"); try (InputStream is2 = cl.getResourceAsStream(resourceLocation)) { System.out.println(" contents=\n" + IO.readContents(is2));
System.out.println(" NetcdfDataset URL = <" + ncmlResourceLocation + ">"); InputStream is2 = cl.getResourceAsStream(ncmlResourceLocation); System.out.println(" contents=\n" + IO.readContents(is2));
System.out.println(" NetcdfDataset URL = <" + ncmlResourceLocation + ">"); try (InputStream is2 = cl.getResourceAsStream(ncmlResourceLocation)) { System.out.println(" contents=\n" + IO.readContents(is2));
System.out.println(" NetcdfDataset URL = <" + ncmlResourceLocation + ">"); try (InputStream is2 = cl.getResourceAsStream(ncmlResourceLocation)) { System.out.println(" contents=\n" + IO.readContents(is2));
public TableConfig readConfigXMLfromResource(String resourceLocation, FeatureType wantFeatureType, NetcdfDataset ds, Formatter errlog) throws IOException { ClassLoader cl = this.getClass().getClassLoader(); InputStream is = cl.getResourceAsStream(resourceLocation); if (is == null) throw new FileNotFoundException(resourceLocation); if (debugXML) { System.out.println(" PointConfig URL = <" + resourceLocation + ">"); InputStream is2 = cl.getResourceAsStream(resourceLocation); System.out.println(" contents=\n" + IO.readContents(is2)); } org.jdom2.Document doc; try { SAXBuilder builder = new SAXBuilder(false); if (debugURL) System.out.println(" PointConfig URL = <" + resourceLocation + ">"); doc = builder.build(is); } catch (JDOMException e) { throw new IOException(e.getMessage()); } if (debugXML) System.out.println(" SAXBuilder done"); if (showParsedXML) { XMLOutputter xmlOut = new XMLOutputter(); System.out.println("*** PointConfig/showParsedXML = \n" + xmlOut.outputString(doc) + "\n*******"); } Element configElem = doc.getRootElement(); String featureType = configElem.getAttributeValue("featureType"); Element tableElem = configElem.getChild("table"); TableConfig tc = parseTableConfig(ds, tableElem, null); tc.featureType = FeatureType.valueOf(featureType); return tc; }
System.out.println(" PointConfig URL = <" + resourceLocation + ">"); try (InputStream is2 = cl.getResourceAsStream(resourceLocation)) { System.out.println(" contents=\n" + IO.readContents(is2));
System.out.printf("response= '%s'%n", IO.readContents(is));