Package java.io

Examples of java.io.ByteArrayInputStream.available()


         int length = ObjectOutputStreamMicro.writeMessage(baos, oid, key, qos, content);
         assertEquals("wrong length returned", oid.length() + key.length() + qos.length() + content.length + 3, length);
         ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
         ObjectInputStreamMicro oism = new ObjectInputStreamMicro(bais);

         int size = bais.available();
         assertEquals("wrong length of bytes available", length, size);
         byte[] msg = new byte[size];
         bais.read(msg);
         MsgHolder msgHolder = ObjectInputStreamMicro.readMessage(msg);
        
View Full Code Here


            else
            {
                throw new UnsupportedEncodingException("Unknown encoding: " +
                                                    encoding);
            }
            len = bis.available();
            bytes = new byte[len];
            len = is.read(bytes, 0, len);
            String ret = new String(bytes, 0, len, charset);
            if (text.length() > end + 2)
            {
View Full Code Here

        {
            RedMask = read4Bytes("RedMask", is, "Not a Valid ICO File");
            GreenMask = read4Bytes("GreenMask", is, "Not a Valid ICO File");
            BlueMask = read4Bytes("BlueMask", is, "Not a Valid ICO File");
        }
        byte[] RestOfFile = readByteArray("RestOfFile", is.available(), is);

        if (Size != 40)
            throw new ImageReadException("Not a Valid ICO File: Wrong bitmap header size " + Size);
        if (Planes != 1)
            throw new ImageReadException("Not a Valid ICO File: Planes can't be " + Planes);
View Full Code Here

        ByteArrayInputStream reader = new ByteArrayInputStream(fragment, off, len);

        // Update the handshake hashes
        updateHandshakeHashes(fragment);

        while (reader.available() > 0 && !isComplete()) {

            int type = reader.read();

            int length = (reader.read() & 0xFF) << 16 | (reader.read() & 0xFF) << 8 | (reader.read() & 0xFF);
View Full Code Here

        try {

            boolean trusted = false;

            X509Certificate chainCert;
            while (in.available() > 0 && !trusted) {
                // The length of the next certificate (we dont need this as rthe
                // DERInputStream does the work
                int certlen = (in.read() & 0xFF) << 16 | (in.read() & 0xFF) << 8 | (in.read() & 0xFF);

                // Now read the certificate
View Full Code Here

            }

            if(encodedContent.length() > 0) {
              if(charsetEncoding==null) {
                ByteArrayInputStream in = new ByteArrayInputStream(encodedContent.getBytes());
                setContent(in, in.available(), "application/x-www-form-urlencoded");
              } else {
                ByteArrayInputStream in = new ByteArrayInputStream(encodedContent.getBytes(charsetEncoding));
                setContent(in, in.available(), "application/x-www-form-urlencoded");
              }
            }
View Full Code Here

              if(charsetEncoding==null) {
                ByteArrayInputStream in = new ByteArrayInputStream(encodedContent.getBytes());
                setContent(in, in.available(), "application/x-www-form-urlencoded");
              } else {
                ByteArrayInputStream in = new ByteArrayInputStream(encodedContent.getBytes(charsetEncoding));
                setContent(in, in.available(), "application/x-www-form-urlencoded");
              }
            }
        }

        // Setup all the proxied headers
View Full Code Here

      }
    else
      {
      ByteArrayInputStream baIn =
        new ByteArrayInputStream( val.getBytes() );
      pS.setAsciiStream( col, baIn, baIn.available() );
      }
    }

  /**
   * FOR ORACLE USERS
View Full Code Here

  }

  public void toOutputStream(OutputStream out) throws IOException {
    if (_source.length > 0) {
      ByteArrayInputStream in = new ByteArrayInputStream(_source);
      while (in.available() > 0) {
        out.write(in.read());
      }
    }
  }
}
View Full Code Here

                                ByteArrayInputStream bais =
                                    convertAsByteArrayInputStream( stream );
                               
                                if (SanityManager.DEBUG) {
                  trace("parameter value is a LOB with length:" +
                      bais.available() );
                }
                               
                ps.setBinaryStream(i+1,
                                                   bais,
                           bais.available() );
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.