java.sql.SQLXML.getCharacterStream()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(115)

本文整理了Java中java.sql.SQLXML.getCharacterStream()方法的一些代码示例,展示了SQLXML.getCharacterStream()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SQLXML.getCharacterStream()方法的具体详情如下:
包路径:java.sql.SQLXML
类名称:SQLXML
方法名:getCharacterStream

SQLXML.getCharacterStream介绍

[英]Returns a reader that can be used to read character data from this SQL XML object.
[中]返回可用于从此SQL XML对象读取字符数据的读取器。

代码示例

代码示例来源:origin: spring-projects/spring-framework

@Override
@Nullable
public Reader getXmlAsCharacterStream(ResultSet rs, String columnName) throws SQLException {
  SQLXML xmlObject = rs.getSQLXML(columnName);
  return (xmlObject != null ? xmlObject.getCharacterStream() : null);
}

代码示例来源:origin: spring-projects/spring-framework

@Override
@Nullable
public Reader getXmlAsCharacterStream(ResultSet rs, int columnIndex) throws SQLException {
  SQLXML xmlObject = rs.getSQLXML(columnIndex);
  return (xmlObject != null ? xmlObject.getCharacterStream() : null);
}

代码示例来源:origin: co.paralleluniverse/comsat-jdbc

@Override
  public Reader call() throws SQLException {
    return sqlXML.getCharacterStream();
  }
});

代码示例来源:origin: org.teiid/teiid-common-core

public Reader getCharacterStream() throws SQLException {
  return this.reference.getCharacterStream();
}

代码示例来源:origin: teiid/teiid

public Reader getCharacterStream() throws SQLException {
  return this.reference.getCharacterStream();
}

代码示例来源:origin: teiid/teiid

@Override
public Reader getCharacterStream() throws IOException {
  try {
    return sqlxml.getCharacterStream();
  } catch (SQLException e) {
    throw new IOException(e);
  }
}

代码示例来源:origin: org.teiid/teiid-common-core

@Override
public Reader getCharacterStream() throws IOException {
  try {
    return sqlxml.getCharacterStream();
  } catch (SQLException e) {
    throw new IOException(e);
  }
}

代码示例来源:origin: org.teiid/teiid-client

static final Reader getCharacterStream(Object value) throws SQLException {
  if (value == null) {
    return null;
  }
  if (value instanceof Clob) {
    return ((Clob) value).getCharacterStream();
  }
  
  if (value instanceof SQLXML) {
    return ((SQLXML)value).getCharacterStream();
  }
  
  return new StringReader(getString(value));
}

代码示例来源:origin: org.jboss.teiid/teiid-engine

public InputStream getInputStream() throws IOException {
    try {
      return new ReaderInputStream(sqlxml.getCharacterStream(), encoding);
    } catch (SQLException e) {
      throw new IOException(e);
    }
  }
};

代码示例来源:origin: org.teiid/teiid-engine

public InputStream getInputStream() throws IOException {
    try {
      return new ReaderInputStream(sqlxml.getCharacterStream(), encoding);
    } catch (SQLException e) {
      throw new IOException(e);
    }
  }
};

代码示例来源:origin: teiid/teiid

public InputStream getInputStream() throws IOException {
    try {
      return new ReaderInputStream(sqlxml.getCharacterStream(), encoding);
    } catch (SQLException e) {
      throw new IOException(e);
    }
  }
};

代码示例来源:origin: teiid/teiid

static final Reader getCharacterStream(Object value) throws SQLException {
  if (value == null) {
    return null;
  }
  if (value instanceof Clob) {
    return ((Clob) value).getCharacterStream();
  }
  
  if (value instanceof SQLXML) {
    return ((SQLXML)value).getCharacterStream();
  }
  
  return new StringReader(getString(value));
}

代码示例来源:origin: apache/servicemix-bundles

@Override
@Nullable
public Reader getXmlAsCharacterStream(ResultSet rs, int columnIndex) throws SQLException {
  SQLXML xmlObject = rs.getSQLXML(columnIndex);
  return (xmlObject != null ? xmlObject.getCharacterStream() : null);
}

代码示例来源:origin: org.springframework/org.springframework.jdbc

public Reader getXmlAsCharacterStream(ResultSet rs, int columnIndex) throws SQLException {
  return rs.getSQLXML(columnIndex).getCharacterStream();
}

代码示例来源:origin: org.springframework/org.springframework.jdbc

public Reader getXmlAsCharacterStream(ResultSet rs, String columnName) throws SQLException {
  return rs.getSQLXML(columnName).getCharacterStream();
}

代码示例来源:origin: org.teiid/teiid-client

static final InputStream getAsciiStream(Object value) throws SQLException {
  if (value == null) {
    return null;
  }
  if (value instanceof Clob) {
    return ((Clob) value).getAsciiStream();
  }
  
  if (value instanceof SQLXML) {
    //TODO: could check the SQLXML encoding
    return new ReaderInputStream(((SQLXML)value).getCharacterStream(), Charset.forName("ASCII")); //$NON-NLS-1$
  }
  
  return new ByteArrayInputStream(getString(value).getBytes(Charset.forName("ASCII"))); //$NON-NLS-1$
}

代码示例来源:origin: teiid/teiid

static final InputStream getAsciiStream(Object value) throws SQLException {
  if (value == null) {
    return null;
  }
  if (value instanceof Clob) {
    return ((Clob) value).getAsciiStream();
  }
  
  if (value instanceof SQLXML) {
    //TODO: could check the SQLXML encoding
    return new ReaderInputStream(((SQLXML)value).getCharacterStream(), Charset.forName("ASCII")); //$NON-NLS-1$
  }
  
  return new ByteArrayInputStream(getString(value).getBytes(Charset.forName("ASCII"))); //$NON-NLS-1$
}

代码示例来源:origin: nuodb/migration-tools

@Override
  public <X> X unwrap(SQLXML value, Class<X> valueClass, Connection connection) throws SQLException {
    if (value == null) {
      return null;
    } else if (valueClass.isAssignableFrom(SQLXML.class)) {
      return (X) value;
    } else if (valueClass.isAssignableFrom(String.class)) {
      try {
        return (X) IOUtils.toString(value.getCharacterStream());
      } catch (IOException exception) {
        throw new JdbcTypeException(exception);
      }
    } else if (valueClass.isAssignableFrom(InputStream.class)) {
      try {
        return (X) IOUtils.toString(value.getBinaryStream());
      } catch (IOException exception) {
        throw new JdbcTypeException(exception);
      }
    } else if (valueClass.isAssignableFrom(Reader.class)) {
      return (X) value.getCharacterStream();
    } else {
      throw newUnwrapFailure(valueClass);
    }
  }
}

代码示例来源:origin: org.teiid.connectors/translator-swagger

ObjectConverterUtil.convertToByteArray(((Blob) value).getBinaryStream())));
} else if (value instanceof SQLXML) { 
  json.writeString(ObjectConverterUtil.convertToString(((SQLXML) value).getCharacterStream()));
} else if (value instanceof byte[] ) {
  json.writeString(Base64.encodeBytes((byte[])value));

代码示例来源:origin: org.teiid.connectors/translator-swagger

} else if (value instanceof SQLXML) { 
  json.writeStringField(key, 
      ObjectConverterUtil.convertToString(((SQLXML) value).getCharacterStream()));
} else if (value instanceof byte[] ) {
  json.writeStringField(key, Base64.encodeBytes((byte[])value));

相关文章