Package liquibase.resource

Examples of liquibase.resource.UtfBomAwareReader


     * @param ins The InputStream to read.
     * @return The contents of the input stream as a String
     * @throws IOException If there is an error reading the stream.
     */
    public static String getStreamContents(InputStream ins) throws IOException {
        return getReaderContents(new UtfBomAwareReader(ins));
    }
View Full Code Here


     * @return The contents of the input stream as a String
     * @throws IOException If there is an error reading the stream.
     */
  public static String getStreamContents(InputStream ins, String charsetName)
      throws IOException {
    UtfBomAwareReader reader;

        if (ins  == null) {
            throw new IOException("No stream to open");
        }

    if (charsetName == null) {
      reader = new UtfBomAwareReader(ins);
    } else {
      String charsetCanonicalName = Charset.forName(charsetName).name();
      String encoding;

      reader = new UtfBomAwareReader(ins, charsetName);
      encoding = Charset.forName(reader.getEncoding()).name();

      if (charsetCanonicalName.startsWith("UTF")
          && !charsetCanonicalName.equals(encoding)) {
        reader.close();
        throw new IllegalArgumentException("Expected encoding was '"
            + charsetCanonicalName + "' but a BOM was detected for '"
            + encoding + "'");
      }
    }
View Full Code Here

  @SuppressWarnings("resource")
  private Reader createReader(InputStream in, String encoding) throws UnsupportedEncodingException {
    return new BufferedReader(
        StringUtils.trimToNull(encoding) == null
          ? new UtfBomAwareReader(in)
          : new UtfBomAwareReader(in, encoding));
  }
View Full Code Here

        if (stream == null) {
            return null;
        }
        Reader streamReader;
        if (getEncoding() == null) {
            streamReader = new UtfBomAwareReader(stream);
        } else {
            streamReader = new UtfBomAwareReader(stream, getEncoding());
        }

        char quotchar;
        if (StringUtils.trimToEmpty(this.quotchar).length() == 0) {
            // hope this is impossible to have a field surrounded with non ascii char 0x01
View Full Code Here

            if (changeLogFile.endsWith(".sql")) {
                InputStream fileStream = openChangeLogFile(changeLogFile, resourceAccessor);
                if (fileStream == null) {
                    return false;
                }
                reader = new BufferedReader(new UtfBomAwareReader(fileStream));

                String line = reader.readLine();
                return line != null && line.matches("\\-\\-\\s*liquibase formatted.*");
            } else {
                return false;
View Full Code Here

        changeLog.setPhysicalFilePath(physicalChangeLogLocation);

        BufferedReader reader = null;

        try {
            reader = new BufferedReader(new UtfBomAwareReader(openChangeLogFile(physicalChangeLogLocation, resourceAccessor)));
            StringBuffer currentSql = new StringBuffer();
            StringBuffer currentRollbackSql = new StringBuffer();

            ChangeSet changeSet = null;
            RawSQLChange change = null;
View Full Code Here

TOP

Related Classes of liquibase.resource.UtfBomAwareReader

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.