Package com.google.caja

Examples of com.google.caja.SomethingWidgyHappenedError


    try {
      Writer w = new OutputStreamWriter(out, Charsets.UTF_8);
      w.write(content);
      w.flush();
    } catch (UnsupportedEncodingException ex) {
      throw new SomethingWidgyHappenedError(ex);
    } catch (IOException ex) {
      throw new SomethingWidgyHappenedError(ex);
    }
    registerUri(uri, out.toByteArray(), contentType, "UTF-8");
  }
View Full Code Here


          tok = "" + Math.abs(rnd.nextFloat());
          break;
        case LINE_CONTINUATION:
          continue;
        default:
          throw new SomethingWidgyHappenedError();
      }
      tokens.add(tok);
    }
    return tokens;
  }
View Full Code Here

    public Object parseDom(InputStream in) throws IOException, SAXException {
      try {
        return DocumentBuilderFactory.newInstance().newDocumentBuilder()
            .parse(in);
      } catch (ParserConfigurationException ex) {
        throw new SomethingWidgyHappenedError(ex);
      }
    }
View Full Code Here

    public InputStream streamFromString(String str) {
      try {
        return new ByteArrayInputStream(
            str.getBytes(Charsets.UTF_8.name()));
      } catch (UnsupportedEncodingException ex) {
        throw new SomethingWidgyHappenedError(ex);
      }
    }
View Full Code Here

        out.write(bytes);
      } finally {
        out.close();
      }
    } catch (IOException e) {
      throw new SomethingWidgyHappenedError(e);
    }
  }
View Full Code Here

          assert uri.isOpaque();
          try {
            instream = new ByteArrayInputStream(
                uri.getSchemeSpecificPart().getBytes(Charsets.UTF_8.name()));
          } catch (UnsupportedEncodingException ex) {
            throw new SomethingWidgyHappenedError(
                "UTF-8 not supported", ex);
          }
        }

        @Override
View Full Code Here

      byte[] bytes = ((ByteArrayOutputStream) output).toByteArray();
      if (enc != null) {
        try {
          return new String(bytes, enc);
        } catch (UnsupportedEncodingException ex) {
          throw new SomethingWidgyHappenedError(ex);
        }
      }
      return bytes;
    }
    return ((StringWriter) output).toString();
View Full Code Here

    try {
      return DomParser.makeTokenQueue(
          FilePosition.startOfFile(is), new StringReader(sgmlInput),
          asXml, wantsComments);
    } catch (IOException ex) {
      throw new SomethingWidgyHappenedError(ex);
    }
  }
View Full Code Here

  private static List<String> formatLines(Node node) {
    StringBuilder sb = new StringBuilder();
    try {
      new Formatter(true, sb).format(node);
    } catch (IOException ex) {
      throw new SomethingWidgyHappenedError(ex);
    }
    return sb.length() == 0
        ? Collections.<String>emptyList()
        : Arrays.asList(sb.toString().split("\n"));
  }
View Full Code Here

  private static String formatToString(Node node, boolean withDebugData) {
    StringBuilder sb = new StringBuilder();
    try {
      new Formatter(withDebugData, sb).format(node);
    } catch (IOException ex) {
      throw new SomethingWidgyHappenedError(ex);
    }
    return sb.toString();
  }
View Full Code Here

TOP

Related Classes of com.google.caja.SomethingWidgyHappenedError

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.