165166167168169170171172
Validator validator = schema.newValidator(); validator.validate(source); } catch (SAXException e) { throw new XmlException("Validation error.", e); } catch (IOException e) { throw new IORuntimeException(e); } }
5455565758596061
try { Writer writer = getWriter(getFileOutputStream(fileName)); marshal(writer, object); writer.close(); } catch (IOException e) { throw new IORuntimeException(e); } }
7576777879808182
Reader reader = getReader(getFileInputStream(fileName)); Object object = unmarshal(reader); reader.close(); return object; } catch (IOException e) { throw new IORuntimeException(e); } }
161162163164165166167168169170171
private void readCharacter() { int readResult; try { readResult = reader.read(); } catch (IOException e) { throw new IORuntimeException(e); } if (readResult == -1) { length = position; } else { char character = (char)readResult;
3334353637383940
try { BufferedReader reader = new BufferedReader(new InputStreamReader( inputStream, "utf-8")); return reader; } catch (UnsupportedEncodingException e) { throw new IORuntimeException(e); } }
4243444546474849
public static PrintWriter getWriter(OutputStream outputStream) { try { return new PrintWriter(new OutputStreamWriter((outputStream), "utf-8"), true); } catch (UnsupportedEncodingException e) { throw new IORuntimeException(e); } }
5051525354555657
public static FileInputStream getFileInputStream(String fileName) { try { return new FileInputStream(fileName); } catch (FileNotFoundException e) { throw new IORuntimeException(e); } }
5859606162636465
public static FileOutputStream getFileOutputStream(String fileName) { try { return new FileOutputStream(fileName); } catch (FileNotFoundException e) { throw new IORuntimeException(e); } }
123124125126127128129130
int count; while ((count = reader.read(readBuffer)) != -1) { writer.write(readBuffer, 0, count); } } catch (IOException e) { throw new IORuntimeException(e); } }