Tabnine Logo
StreamUtils.copy
Code IndexAdd Tabnine to your IDE (free)

How to use
copy
method
in
org.hibernate.engine.jdbc.StreamUtils

Best Java code snippets using org.hibernate.engine.jdbc.StreamUtils.copy (Showing top 15 results out of 315)

origin: hibernate/hibernate-orm

/**
 * Copy the inputStream to the outputStream.  Uses a buffer of the default size ({@link #DEFAULT_CHUNK_SIZE}).
 *
 * @param inputStream The input stream to read
 * @param outputStream The output stream to write to
 *
 * @return The number of bytes read
 *
 * @throws IOException If a problem occurred accessing either stream
 */
public static long copy(InputStream inputStream, OutputStream outputStream) throws IOException {
  return copy( inputStream, outputStream, DEFAULT_CHUNK_SIZE );
}
origin: hibernate/hibernate-orm

/**
 * Copy the reader to the writer.  Uses a buffer of the default size ({@link #DEFAULT_CHUNK_SIZE}).
 *
 * @param reader The reader to read from
 * @param writer The writer to write to
 *
 * @return The number of bytes read
 *
 * @throws IOException If a problem occurred accessing reader or writer
 */
public static long copy(Reader reader, Writer writer) throws IOException {
  return copy( reader, writer, DEFAULT_CHUNK_SIZE );
}
origin: org.hibernate.orm/hibernate-core

/**
 * Copy the inputStream to the outputStream.  Uses a buffer of the default size ({@link #DEFAULT_CHUNK_SIZE}).
 *
 * @param inputStream The input stream to read
 * @param outputStream The output stream to write to
 *
 * @return The number of bytes read
 *
 * @throws IOException If a problem occurred accessing either stream
 */
public static long copy(InputStream inputStream, OutputStream outputStream) throws IOException {
  return copy( inputStream, outputStream, DEFAULT_CHUNK_SIZE );
}
origin: org.hibernate/com.springsource.org.hibernate

public static long copy(Reader reader, Writer writer) throws IOException {
  return copy( reader, writer, DEFAULT_CHUNK_SIZE );
}
origin: org.hibernate.orm/hibernate-core

/**
 * Copy the reader to the writer.  Uses a buffer of the default size ({@link #DEFAULT_CHUNK_SIZE}).
 *
 * @param reader The reader to read from
 * @param writer The writer to write to
 *
 * @return The number of bytes read
 *
 * @throws IOException If a problem occurred accessing reader or writer
 */
public static long copy(Reader reader, Writer writer) throws IOException {
  return copy( reader, writer, DEFAULT_CHUNK_SIZE );
}
origin: org.hibernate/com.springsource.org.hibernate.core

public static long copy(InputStream inputStream, OutputStream outputStream) throws IOException {
  return copy( inputStream, outputStream, DEFAULT_CHUNK_SIZE );
}
origin: org.hibernate/com.springsource.org.hibernate

public static long copy(InputStream inputStream, OutputStream outputStream) throws IOException {
  return copy( inputStream, outputStream, DEFAULT_CHUNK_SIZE );
}
origin: org.hibernate/com.springsource.org.hibernate.core

public static long copy(Reader reader, Writer writer) throws IOException {
  return copy( reader, writer, DEFAULT_CHUNK_SIZE );
}
origin: org.beangle.commons/beangle-commons-orm

public Blob createBlob(InputStream inputStream) {
 try {
  ByteArrayOutputStream buffer = new ByteArrayOutputStream(inputStream.available());
  StreamUtils.copy(inputStream, buffer);
  return Hibernate.getLobCreator(getSession()).createBlob(buffer.toByteArray());
 } catch (Exception e) {
  throw new RuntimeException(e);
 }
}
origin: org.hibernate/com.springsource.org.hibernate.core

/**
 * {@inheritDoc}
 */
public Blob createBlob(InputStream inputStream, long length) {
  try {
    Blob blob = createBlob();
    OutputStream byteStream = blob.setBinaryStream( 1 );
    StreamUtils.copy( inputStream, byteStream );
    byteStream.flush();
    byteStream.close();
    // todo : validate length written versus length given?
    return blob;
  }
  catch ( SQLException e ) {
    throw new JDBCException( "Unable to prepare BLOB binary stream for writing",e );
  }
  catch ( IOException e ) {
    throw new HibernateException( "Unable to write stream contents to BLOB", e );
  }
}
origin: org.hibernate/com.springsource.org.hibernate

/**
 * {@inheritDoc}
 */
public Clob createClob(Reader reader, long length) {
  try {
    Clob clob = createClob();
    Writer writer = clob.setCharacterStream( 1 );
    StreamUtils.copy( reader, writer );
    writer.flush();
    writer.close();
    return clob;
  }
  catch ( SQLException e ) {
    throw new JDBCException( "Unable to prepare CLOB stream for writing", e );
  }
  catch ( IOException e ) {
    throw new HibernateException( "Unable to write CLOB stream content", e );
  }
}
origin: org.hibernate/com.springsource.org.hibernate.core

/**
 * {@inheritDoc}
 */
public Clob createClob(Reader reader, long length) {
  try {
    Clob clob = createClob();
    Writer writer = clob.setCharacterStream( 1 );
    StreamUtils.copy( reader, writer );
    writer.flush();
    writer.close();
    return clob;
  }
  catch ( SQLException e ) {
    throw new JDBCException( "Unable to prepare CLOB stream for writing", e );
  }
  catch ( IOException e ) {
    throw new HibernateException( "Unable to write CLOB stream content", e );
  }
}
origin: org.hibernate/com.springsource.org.hibernate

/**
 * {@inheritDoc}
 */
public NClob createNClob(Reader reader, long length) {
  try {
    NClob nclob = createNClob();
    Writer writer = nclob.setCharacterStream( 1 );
    StreamUtils.copy( reader, writer );
    writer.flush();
    writer.close();
    return nclob;
  }
  catch ( SQLException e ) {
    throw new JDBCException( "Unable to prepare NCLOB stream for writing", e );
  }
  catch ( IOException e ) {
    throw new HibernateException( "Unable to write NCLOB stream content", e );
  }
}
origin: org.hibernate/com.springsource.org.hibernate.core

/**
 * {@inheritDoc}
 */
public NClob createNClob(Reader reader, long length) {
  try {
    NClob nclob = createNClob();
    Writer writer = nclob.setCharacterStream( 1 );
    StreamUtils.copy( reader, writer );
    writer.flush();
    writer.close();
    return nclob;
  }
  catch ( SQLException e ) {
    throw new JDBCException( "Unable to prepare NCLOB stream for writing", e );
  }
  catch ( IOException e ) {
    throw new HibernateException( "Unable to write NCLOB stream content", e );
  }
}
origin: org.hibernate/com.springsource.org.hibernate

/**
 * {@inheritDoc}
 */
public Blob createBlob(InputStream inputStream, long length) {
  try {
    Blob blob = createBlob();
    OutputStream byteStream = blob.setBinaryStream( 1 );
    StreamUtils.copy( inputStream, byteStream );
    byteStream.flush();
    byteStream.close();
    // todo : validate length written versus length given?
    return blob;
  }
  catch ( SQLException e ) {
    throw new JDBCException( "Unable to prepare BLOB binary stream for writing",e );
  }
  catch ( IOException e ) {
    throw new HibernateException( "Unable to write stream contents to BLOB", e );
  }
}
org.hibernate.engine.jdbcStreamUtilscopy

Javadoc

Copy the inputStream to the outputStream. Uses a buffer of the default size ( #DEFAULT_CHUNK_SIZE).

Popular methods of StreamUtils

    Popular in Java

    • Finding current android device location
    • setContentView (Activity)
    • requestLocationUpdates (LocationManager)
    • scheduleAtFixedRate (ScheduledExecutorService)
    • BufferedReader (java.io)
      Wraps an existing Reader and buffers the input. Expensive interaction with the underlying reader is
    • KeyStore (java.security)
      KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
    • Connection (java.sql)
      A connection represents a link from a Java application to a database. All SQL statements and results
    • Cipher (javax.crypto)
      This class provides access to implementations of cryptographic ciphers for encryption and decryption
    • JPanel (javax.swing)
    • Options (org.apache.commons.cli)
      Main entry-point into the library. Options represents a collection of Option objects, which describ
    • PhpStorm for WordPress
    Tabnine Logo
    • Products

      Search for Java codeSearch for JavaScript code
    • IDE Plugins

      IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
    • Company

      About UsContact UsCareers
    • Resources

      FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
    Get Tabnine for your IDE now