Package com.caucho.vfs

Examples of com.caucho.vfs.TempBuffer


                         @Optional("0") int length)
  {
    if (length <= 0)
      length = Integer.MAX_VALUE;
   
    TempBuffer tempBuf = TempBuffer.allocate();
    byte []buffer = tempBuf.getBuffer();
    Inflater inflater = null;

    try {
      inflater = new Inflater(true);
      StringValue sb = env.createBinaryBuilder();
View Full Code Here


   */
  public Value gzencode(Env env, InputStream is,
                        @Optional("6") int level,
                        @Optional("1") int encodingMode)
  {
    TempBuffer tempBuf = TempBuffer.allocate();
    byte[] buffer = tempBuf.getBuffer();

    TempStream ts = new TempStream();
    StreamImplOutputStream out = new StreamImplOutputStream(ts);

    ZlibOutputStream gzOut = null;
View Full Code Here

    if (_fileValue == null) {
      env.warning(L.l("file could not be open for writing"));
      return -1;
    }

    TempBuffer tb = TempBuffer.allocate();
    byte[] buffer = tb.getBuffer();

    int inputSize = 0;
    int sublen;

    if (length < 0)
View Full Code Here

  public static Value socket_read(Env env,
                                  @NotNull SocketInputOutput socket,
                                  int length, @Optional int type)
  {
    TempBuffer tempBuffer = null;
    TempCharBuffer tempCharBuffer = null;

    try {
      if (type == PHP_NORMAL_READ) {
        return socket.readLine(length);
      } else {
        tempBuffer = TempBuffer.allocate();

        if (length > tempBuffer.getCapacity())
          length = tempBuffer.getCapacity();

        byte []buffer = tempBuffer.getBuffer();

        length = socket.read(buffer, 0, length);

        if (length > 0) {
          StringValue sb = env.createBinaryBuilder(buffer, 0, length);
View Full Code Here

    }
   
    ws.close();
   
    out.writeInt(ts.getLength());
    TempBuffer ptr = ts.getHead();

    for (; ptr != null; ptr = ptr.getNext())
      out.write(ptr.getBuffer(), 0, ptr.getLength());

    ts.destroy();
  }
View Full Code Here

      BytesMessage bytesMessage = (BytesMessage) message;
      int length = (int) bytesMessage.getBodyLength();

      StringValue bb = env.createBinaryBuilder(length);

      TempBuffer tempBuffer = TempBuffer.allocate();
      int sublen;

      while (true) {
        sublen = bytesMessage.readBytes(tempBuffer.getBuffer());

        if (sublen > 0)
          bb.append(tempBuffer.getBuffer(), 0, sublen);
        else
          break;
      }

      TempBuffer.free(tempBuffer);
View Full Code Here

        return -1;

      if (out == null)
        return -1;

      TempBuffer temp = TempBuffer.allocate();
      byte []buffer = temp.getBuffer();

      while (offset-- > 0)
        in.read();

      if (length < 0)
View Full Code Here

          if (length <= 0)
            length = -1;
        }

        if (length < 0) {
          TempBuffer tempBuffer = TempBuffer.allocate();

          try {
            byte[] bytes = new byte[1024];

            int len;

            while ((len = inputStream.read(bytes, 0, 1024)) != -1)
              tempBuffer.write(bytes, 0, len);
          }
          catch (IOException ex) {
            _error.error(ex);
            return false;
          }

          TempReadStream tempReadStream = new TempReadStream(tempBuffer);
          tempReadStream.setFreeWhenDone(true);

          _preparedStatement.setBinaryStream(
              index, new ReadStream(tempReadStream), tempBuffer.getLength());
        }
        else
          _preparedStatement.setBinaryStream(index, inputStream, (int) length);
      }
    }
View Full Code Here

   */
  public int write(InputStream is, int length)
  {
    int writeLength = 0;

    TempBuffer tb = TempBuffer.allocate();
    byte []buffer = tb.getBuffer();

    try {
      while (length > 0) {
        int sublen;

View Full Code Here

   */
  public int write(InputStream is, int length)
  {
    int writeLength = 0;

    TempBuffer tb = TempBuffer.allocate();
    byte []buffer = tb.getBuffer();

    try {
      while (length > 0) {
        int sublen;

View Full Code Here

TOP

Related Classes of com.caucho.vfs.TempBuffer

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.