Java SQL Blob getString(Blob blob)

Here you can find the source of getString(Blob blob)

Description

get String

License

Open Source License

Declaration

public static String getString(Blob blob) throws UnsupportedEncodingException, SQLException, IOException 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import java.io.UnsupportedEncodingException;
import java.sql.Blob;
import java.sql.SQLException;

public class Main {

    public static String getString(Blob blob) throws UnsupportedEncodingException, SQLException, IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(blob.getBinaryStream(), "utf-8"));
        String s = null;//from   w  ww .j  a  v  a2s  .  c o m
        StringBuilder sb = new StringBuilder();
        while ((s = br.readLine()) != null) {
            sb.append(s);
        }
        return sb.toString();
    }
}

Related

  1. getAsString(Blob blob)
  2. getBlobType(byte[] image)
  3. getDataFromBlob(Blob b)
  4. getDataFromBlob(Blob b)
  5. getLongBlobTypeString(Connection conn)
  6. getStringValue(Blob blob)
  7. isBlob(Object object)
  8. readBlob(Blob blob)
  9. readBytes(Blob blob, byte[] defaultValue)