Package java.io

Examples of java.io.InputStream.available()


        String s;
        ResourceDownloaderFactory rdf = ResourceDownloaderFactoryImpl.getSingleton();
        try {
          ResourceDownloader rd = rdf.create(new URL(url));
          InputStream is = rd.download();
          int length = is.available();
          byte data[] = new byte[length];
          is.read(data);
          is.close();
          s = new String(data);
        } catch (ResourceDownloaderException rde) {
View Full Code Here


    {
       
        try
        {
            InputStream inStr = source.getInputStream();
            int size = inStr.available();
            byte[] data = new byte[size];
            inStr.read(data);
            inStr.close();
            return new String(data);
View Full Code Here

    InputStream is = rd.download();

    byte data[];

    try {
      int length = is.available();

      data = new byte[length];

      is.read(data);
View Full Code Here

      byte[] buffer = new byte[8192];

      while (true)
      {
        if ((stdout.available() == 0) && (stderr.available() == 0))
        {
          /* Even though currently there is no data available, it may be that new data arrives
           * and the session's underlying channel is closed before we call waitForCondition().
           * This means that EOF and STDOUT_DATA (or STDERR_DATA, or both) may
           * be set together.
View Full Code Here

          int len = stdout.read(buffer);
          if (len > 0) // this check is somewhat paranoid
            System.out.write(buffer, 0, len);
        }

        while (stderr.available() > 0)
        {
          int len = stderr.read(buffer);
          if (len > 0) // this check is somewhat paranoid
            System.err.write(buffer, 0, len);
        }
View Full Code Here

                is = docurl.openStream();
            } catch (IOException e) {
                return false;
            }
            try {
                if(is.available() > 0) {
                    return true;
                } else {
                    return false;
                }
            } catch (IOException e) {
View Full Code Here

            n += nread;
            if(n >= len)
                return n;
            // if not closed but no bytes available, return
            InputStream input = in;
            if(input != null && input.available() <= 0)
                return n;
        }
    }

    /**
 
View Full Code Here

    case Any.IS_CLASS:
    default:
      if (data instanceof anvil.core.io.AnyInputStream) {
        try {
          InputStream input = (InputStream)data.toObject();
          set.setBinaryStream(field, input, input.available());
        } catch (IOException e) {
          throw new SQLException("Exception while setting binary stream: "+e);
        }
      } else {
        set.setString(field, data.toString());
View Full Code Here

      return null;
    }
    InputStream input = null;
    try {
      input = url.openStream();
      int length = (int)input.available();
      int offset = 0;
      byte[] data = new byte[length];
      while(offset < length) {
        int read = input.read(data, offset, length - offset);
        if (read == -1) {
View Full Code Here

        // Write out the rest of the value onto any needed overflow pages
        Page lastPage = page;
        while(true) {
            final int available;
            try {
                available = is.available();
            } catch (IOException e) {
                throw new DbException(e);
            }
            if(available == 0) {
                break;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.