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

x33g5p2x  于2022-01-28 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(434)

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

ResultSet.getBinaryStream介绍

[英]Gets the value of a column specified by column index as a binary stream.

This method can be used to read LONGVARBINARY values. All of the data in the InputStream should be read before getting data from any other column. A further call to a getter method will implicitly close the InputStream.
[中]获取列索引指定为二进制流的列的值。
此方法可用于读取LONGVARBINARY值。在从任何其他列获取数据之前,应先读取InputStream中的所有数据。对getter方法的进一步调用将隐式关闭InputStream。

代码示例

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

@Override
@Nullable
public InputStream getBlobAsBinaryStream(ResultSet rs, int columnIndex) throws SQLException {
  logger.debug("Returning BLOB as binary stream");
  if (this.wrapAsLob) {
    Blob blob = rs.getBlob(columnIndex);
    return blob.getBinaryStream();
  }
  else {
    return rs.getBinaryStream(columnIndex);
  }
}

代码示例来源:origin: alibaba/druid

@Override
public java.io.InputStream getBinaryStream(String columnLabel) throws SQLException {
  try {
    return rs.getBinaryStream(columnLabel);
  } catch (Throwable t) {
    throw checkException(t);
  }
}

代码示例来源:origin: alibaba/druid

@Override
public java.io.InputStream getBinaryStream(int columnIndex) throws SQLException {
  try {
    return rs.getBinaryStream(columnIndex);
  } catch (Throwable t) {
    throw checkException(t);
  }
}

代码示例来源:origin: apache/ignite

@Override public void run() throws Exception {
    rs.getBinaryStream("id");
  }
});

代码示例来源:origin: apache/ignite

@Override public void run() throws Exception {
    rs.getBinaryStream(1);
  }
});

代码示例来源:origin: apache/incubator-shardingsphere

@SuppressWarnings("deprecation")
@Override
public InputStream getInputStream(final int columnIndex, final String type) throws SQLException {
  switch (type) {
    case "Ascii":
      return resultSet.getAsciiStream(columnIndex);
    case "Unicode":
      return resultSet.getUnicodeStream(columnIndex);
    case "Binary":
      return resultSet.getBinaryStream(columnIndex);
    default:
      throw new SQLException(String.format("Unsupported type: %s", type));
  }
}

代码示例来源:origin: apache/incubator-shardingsphere

@SuppressWarnings("deprecation")
@Override
public InputStream getInputStream(final String columnLabel, final String type) throws SQLException {
  switch (type) {
    case "Ascii":
      return resultSet.getAsciiStream(columnLabel);
    case "Unicode":
      return resultSet.getUnicodeStream(columnLabel);
    case "Binary":
      return resultSet.getBinaryStream(columnLabel);
    default:
      throw new SQLException(String.format("Unsupported type: %s", type));
  }
}

代码示例来源:origin: alibaba/druid

@Override
public java.io.InputStream resultSet_getBinaryStream(ResultSetProxy rs, int columnIndex) throws SQLException {
  if (this.pos < filterSize) {
    return nextFilter()
        .resultSet_getBinaryStream(this, rs, columnIndex);
  }
  return rs.getResultSetRaw()
      .getBinaryStream(columnIndex);
}

代码示例来源:origin: alibaba/druid

@Override
public java.io.InputStream resultSet_getBinaryStream(ResultSetProxy rs, String columnLabel) throws SQLException {
  if (this.pos < filterSize) {
    return nextFilter()
        .resultSet_getBinaryStream(this, rs, columnLabel);
  }
  return rs.getResultSetRaw()
      .getBinaryStream(columnLabel);
}

代码示例来源:origin: quartz-scheduler/quartz

@Override
protected Object getJobDataFromBlob(ResultSet rs, String colName)
  throws ClassNotFoundException, IOException, SQLException {
  
  if (canUseProperties()) {
    InputStream binaryInput = rs.getBinaryStream(colName);
    return binaryInput;
  }
  return getObjectFromBlob(rs, colName);
}

代码示例来源:origin: quartz-scheduler/quartz

@Override           
  protected Object getJobDataFromBlob(ResultSet rs, String colName)
    throws ClassNotFoundException, IOException, SQLException {
    if (canUseProperties()) {
      InputStream binaryInput = rs.getBinaryStream(colName);
      return binaryInput;
    }
    return getObjectFromBlob(rs, colName);
  }
}

代码示例来源:origin: quartz-scheduler/quartz

@Override           
  protected Object getJobDataFromBlob(ResultSet rs, String colName)
    throws ClassNotFoundException, IOException, SQLException {
    if (canUseProperties()) {
      InputStream binaryInput = rs.getBinaryStream(colName);
      return binaryInput;
    }
    return getObjectFromBlob(rs, colName);
  }
}

代码示例来源:origin: quartz-scheduler/quartz

@Override           
  protected Object getJobDataFromBlob(ResultSet rs, String colName)
    throws ClassNotFoundException, IOException, SQLException {
    if (canUseProperties()) {
      InputStream binaryInput = rs.getBinaryStream(colName);
      return binaryInput;
    }
    return getObjectFromBlob(rs, colName);
  }
}

代码示例来源:origin: quartz-scheduler/quartz

@Override           
  protected Object getJobDataFromBlob(ResultSet rs, String colName)
    throws ClassNotFoundException, IOException, SQLException {
    if (canUseProperties()) {
      InputStream binaryInput = rs.getBinaryStream(colName);
      return binaryInput;
    }
    return getObjectFromBlob(rs, colName);
  }
}

代码示例来源:origin: quartz-scheduler/quartz

@Override           
protected Object getJobDataFromBlob(ResultSet rs, String colName)
  throws ClassNotFoundException, IOException, SQLException {
  if (canUseProperties()) {
    InputStream binaryInput = rs.getBinaryStream(colName);
    return binaryInput;
  }
  return getObjectFromBlob(rs, colName);
}

代码示例来源:origin: quartz-scheduler/quartz

@Override
protected Object getJobDataFromBlob(ResultSet rs, String colName)
  throws ClassNotFoundException, IOException, SQLException {
  
  if (canUseProperties()) {
    InputStream binaryInput = rs.getBinaryStream(colName);
    return binaryInput;
  }
  return getObjectFromBlob(rs, colName);
}

代码示例来源:origin: quartz-scheduler/quartz

@Override           
protected Object getJobDataFromBlob(ResultSet rs, String colName)
  throws ClassNotFoundException, IOException, SQLException {
  if (canUseProperties()) {
    InputStream binaryInput = rs.getBinaryStream(colName);
    return binaryInput;
  }
  return getObjectFromBlob(rs, colName);
}

代码示例来源:origin: hibernate/hibernate-orm

@Override
public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner)
    throws HibernateException, SQLException {
  final String type = rs.getString( names[0] ); // For debug purpose.
  return convertInputStreamToObject( rs.getBinaryStream( names[1] ) );
}

代码示例来源:origin: nutzam/nutz

@Override
public Object get(ResultSet rs, String colName) throws SQLException {
  InputStream ins = rs.getBinaryStream(colName);
  if (ins == null)
    return null;
  File f = this.createTempFile();
  Files.write(f, ins);
  return new SimpleBlob(f);
}

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

@Test
public void testGetBlobAsBinaryStream() throws SQLException {
  lobHandler.getBlobAsBinaryStream(rs, 1);
  verify(rs).getBinaryStream(1);
}

相关文章

微信公众号

最新文章

更多

ResultSet类方法