Esempio n. 1
0
 public byte[] readAsBytes() throws DescriptorIOException {
   try {
     return FileUtils.readFileToByteArray(new File(locator.getURI().getPath()));
   } catch (IOException ex) {
     throw new DescriptorIOException("Cannot read descriptor: " + locator.getLastName(), ex);
   }
 }
Esempio n. 2
0
 public String readAsString() throws DescriptorIOException {
   byte[] encoded = this.readAsBytes();
   try {
     return new String(encoded, DescriptorWriter.CHARSET);
   } catch (UnsupportedEncodingException e) {
     throw new DescriptorIOException("Cannot read from: " + locator.toString(), e);
   }
 }