Package com.caucho.db.blob

Examples of com.caucho.db.blob.BlobInputStream


    read(_blob, 0, 128);

    CharBuffer cb = _cb;
    cb.clear();

    BlobInputStream is = null;
    try {
      is = new BlobInputStream(_stores[_column], _blob, 0);

      int ch;
      while ((ch = is.read()) >= 0) {
        if (ch < 0x80)
          cb.append((char) ch);
      }
    } catch (IOException e) {
      throw new SQLExceptionWrapper(e);
View Full Code Here


  {
    read(_blob, 0, 128);

    ByteArrayOutputStream bos = new ByteArrayOutputStream();

    BlobInputStream is = null;
    try {
      is = new BlobInputStream(_stores[_column], _blob, 0);

      int ch;
      while ((ch = is.read()) >= 0) {
        bos.write(ch);
      }
    } catch (IOException e) {
      throw new SQLExceptionWrapper(e);
    }
View Full Code Here

    int offset = _offsets[index];

    CharBuffer cb = _cb;
    cb.clear();

    BlobInputStream is = null;
    try {
      is = new BlobInputStream(_stores[index], _buffer, offset);

      int ch;
      while ((ch = is.read()) >= 0) {
        if (ch < 0x80)
          cb.append((char) ch);
      }
    } catch (IOException e) {
      throw new SQLExceptionWrapper(e);
View Full Code Here

  {
    if (isNull(block, rowOffset))
      return null;

    try {
      BlobInputStream is;
      is = new BlobInputStream(getTable(), block, rowOffset + _columnOffset);

      int ch;
      StringBuilder cb = new StringBuilder();

      while ((ch = is.read()) >= 0) {
        if (ch < 0x80)
          cb.append((char) ch);
        else if ((ch & 0xe0) == 0xc0) {
          int ch1 = is.read();

          cb.append((char) (((ch & 0x3f) << 6) +
                            (ch1 & 0x3f)));
        }
        else {
          int ch1 = is.read();
          int ch2 = is.read();

          cb.append((char) (((ch & 0xf) << 12) +
                            ((ch1 & 0x3f) << 6) +
                            ((ch2 & 0x3f))));
        }
      }

      is.close();

      return cb.toString();
    } catch (IOException e) {
      log.log(Level.WARNING, e.toString(), e);
    }
View Full Code Here

   * Returns the blob as a stream.
   */
  public InputStream getBinaryStream()
    throws SQLException
  {
    return new BlobInputStream(_store, _inode, 0);
  }
View Full Code Here

   */
  public InputStream getAsciiStream()
    throws SQLException
  {
    // XXX: lie, since this is utf8
    return new BlobInputStream(_store, _inode, 0);
  }
View Full Code Here

  {
    if (isNull(block, rowOffset))
      return null;

    try {
      BlobInputStream is;
      is = new BlobInputStream(getTable(), block, rowOffset + _columnOffset);

      int ch;
      StringBuilder cb = new StringBuilder();

      while ((ch = is.read()) >= 0) {
  if (ch < 0x80)
    cb.append((char) ch);
  else if ((ch & 0xe0) == 0xc0) {
    int ch1 = is.read();
   
    cb.append((char) (((ch & 0x3f) << 6) +
          (ch1 & 0x3f)));
  }
  else {
    int ch1 = is.read();
    int ch2 = is.read();
   
    cb.append((char) (((ch & 0xf) << 12) +
          ((ch1 & 0x3f) << 6) +
          ((ch2 & 0x3f))));
  }
      }

      is.close();

      return cb.toString();
    } catch (IOException e) {
      log.log(Level.WARNING, e.toString(), e);
    }
View Full Code Here

    read(_blob, 0, 128);

    CharBuffer cb = _cb;
    cb.clear();

    BlobInputStream is = null;
    try {
      is = new BlobInputStream(_stores[_column], _blob, 0);

      int ch;
      while ((ch = is.read()) >= 0) {
        if (ch < 0x80)
          cb.append((char) ch);
      }
    } catch (IOException e) {
      throw new SQLExceptionWrapper(e);
View Full Code Here

  {
    read(_blob, 0, 128);

    ByteArrayOutputStream bos = new ByteArrayOutputStream();

    BlobInputStream is = null;
    try {
      is = new BlobInputStream(_stores[_column], _blob, 0);

      int ch;
      while ((ch = is.read()) >= 0) {
        bos.write(ch);
      }
    } catch (IOException e) {
      throw new SQLExceptionWrapper(e);
    }
View Full Code Here

    int offset = _offsets[index];

    CharBuffer cb = _cb;
    cb.clear();

    BlobInputStream is = null;
    try {
      is = new BlobInputStream(_stores[index], _buffer, offset);

      int ch;
      while ((ch = is.read()) >= 0) {
  if (ch < 0x80)
    cb.append((char) ch);
      }
    } catch (IOException e) {
      throw new SQLExceptionWrapper(e);
View Full Code Here

TOP

Related Classes of com.caucho.db.blob.BlobInputStream

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.