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

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

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

SQLXML.getBinaryStream介绍

[英]Returns a stream that can be used to read binary data from this SQL XML object.
[中]返回可用于从此SQL XML对象读取二进制数据的流。

代码示例

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

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

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

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

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

@Override
  public InputStream call() throws SQLException {
    return sqlXML.getBinaryStream();
  }
});

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

public InputStream getBinaryStream() throws SQLException {
  return this.reference.getBinaryStream();
}

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

public InputStream getBinaryStream() throws SQLException {
  return this.reference.getBinaryStream();
}

代码示例来源:origin: stackoverflow.com

SQLXML sqlxml = resultSet.getSQLXML(column);
InputStream binaryStream = sqlxml.getBinaryStream();

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

@Override
public InputStream getInputStream() throws IOException {
  try {
    return sqlxml.getBinaryStream();
  } catch (SQLException e) {
    throw new IOException(e);
  }
}

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

@Override
public InputStream getInputStream() throws IOException {
  try {
    return sqlxml.getBinaryStream();
  } catch (SQLException e) {
    throw new IOException(e);
  }
}

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

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

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

public InputStream getXmlAsBinaryStream(ResultSet rs, int columnIndex) throws SQLException {
  return rs.getSQLXML(columnIndex).getBinaryStream();
}

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

public InputStream getXmlAsBinaryStream(ResultSet rs, String columnName) throws SQLException {
  return rs.getSQLXML(columnName).getBinaryStream();
}

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

/**
 * Returns the encoding or null if it cannot be determined
 * @param xml
 * @return
 */
public static String getEncoding(SQLXML xml) {
  try {
    if (xml instanceof XMLType) {
      XMLType type = (XMLType)xml;
      if (type.encoding != null) {
        return type.encoding;
      }
      xml = type.reference;
    }
    if (xml instanceof SQLXMLImpl) {
      Charset cs = ((SQLXMLImpl)xml).getCharset();
      if (cs != null) {
        return cs.name();
      }
    }
    return getEncoding(xml.getBinaryStream());
  } catch (SQLException e) {
    return null;
  }
}

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

public java.io.InputStream getBinaryStream(int columnIndex)
    throws SQLException {
  Object value = getObject(columnIndex);
  if (value == null) {
    return null;
  }
  if (value instanceof Blob) {
    return ((Blob) value).getBinaryStream();
  }
  
  if (value instanceof SQLXML) {
    return ((SQLXML)value).getBinaryStream();
  }
  throw new TeiidSQLException(JDBCPlugin.Util.getString("MMResultSet.cannot_convert_to_binary_stream")); //$NON-NLS-1$
}

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

/**
 * Returns the encoding or null if it cannot be determined
 * @param xml
 * @return
 */
public static String getEncoding(SQLXML xml) {
  try {
    if (xml instanceof XMLType) {
      XMLType type = (XMLType)xml;
      if (type.encoding != null) {
        return type.encoding;
      }
      xml = type.reference;
    }
    if (xml instanceof SQLXMLImpl) {
      Charset cs = ((SQLXMLImpl)xml).getCharset();
      if (cs != null) {
        return cs.name();
      }
    }
    return getEncoding(xml.getBinaryStream());
  } catch (SQLException e) {
    return null;
  }
}

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

public java.io.InputStream getBinaryStream(int columnIndex)
    throws SQLException {
  Object value = getObject(columnIndex);
  if (value == null) {
    return null;
  }
  if (value instanceof Blob) {
    return ((Blob) value).getBinaryStream();
  }
  
  if (value instanceof SQLXML) {
    return ((SQLXML)value).getBinaryStream();
  }
  throw new TeiidSQLException(JDBCPlugin.Util.getString("MMResultSet.cannot_convert_to_binary_stream")); //$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.wildfly/rest-service

private InputStream handleResult(String charSet, Object result) throws SQLException {
  if (result == null) {
    return null; //or should this be an empty result?
  }
  if (result instanceof SQLXML) {
    if (charSet != null) {
      XMLSerialize serialize = new XMLSerialize();
      serialize.setTypeString("blob"); //$NON-NLS-1$
      serialize.setDeclaration(true);
      serialize.setEncoding(charSet);
      serialize.setDocument(true);
      try {
        return ((BlobType)XMLSystemFunctions.serialize(serialize, new XMLType((SQLXML)result))).getBinaryStream();
      } catch (TransformationException e) {
        throw new SQLException(e);
      }
    }
    return ((SQLXML)result).getBinaryStream();
  }
  else if (result instanceof Blob) {
    return ((Blob)result).getBinaryStream();
  }
  else if (result instanceof Clob) {
    return new ReaderInputStream(((Clob)result).getCharacterStream(), charSet==null?Charset.defaultCharset():Charset.forName(charSet));
  }
  return new ByteArrayInputStream(result.toString().getBytes(charSet==null?Charset.defaultCharset():Charset.forName(charSet)));
}

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

private InputStream handleResult(String charSet, Object result) throws SQLException {
  if (result == null) {
    return null; //or should this be an empty result?
  }
  if (result instanceof SQLXML) {
    if (charSet != null) {
      XMLSerialize serialize = new XMLSerialize();
      serialize.setTypeString("blob"); //$NON-NLS-1$
      serialize.setDeclaration(true);
      serialize.setEncoding(charSet);
      serialize.setDocument(true);
      try {
        return ((BlobType)XMLSystemFunctions.serialize(serialize, new XMLType((SQLXML)result))).getBinaryStream();
      } catch (TransformationException e) {
        throw new SQLException(e);
      }
    }
    return ((SQLXML)result).getBinaryStream();
  }
  else if (result instanceof Blob) {
    return ((Blob)result).getBinaryStream();
  }
  else if (result instanceof Clob) {
    return new ReaderInputStream(((Clob)result).getCharacterStream(), charSet==null?Charset.defaultCharset():Charset.forName(charSet));
  }
  return new ByteArrayInputStream(result.toString().getBytes(charSet==null?Charset.defaultCharset():Charset.forName(charSet)));
}

代码示例来源:origin: jp.dodododo/samurai-dao

return ((java.sql.SQLXML) value).getBinaryStream();

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

InputStream content = ((SQLXML)result).getBinaryStream();
response.writeContent(content, 200, false);
response.writeOK(ContentType.APPLICATION_XML);

相关文章