Package com.caucho.vfs

Examples of com.caucho.vfs.TempBuffer


   * Clears the response buffer.
   */
  @Override
  public void clearBuffer()
  {
    TempBuffer next = _head.getNext();

    if (next != null) {
      _head.setNext(null);
      TempBuffer.freeAll(next);
    }
View Full Code Here


    }
    else if (_tailByteLength == SIZE) {
      _tail.setLength(_tailByteLength);
      _bufferSize += _tailByteLength;

      TempBuffer tempBuf = TempBuffer.allocate();
      _tail.setNext(tempBuf);
      _tail = tempBuf;

      _tailByteBuffer = _tail.getBuffer();
      _tailByteLength = 0;
View Full Code Here

    while (length > 0) {
      if (SIZE <= byteLength) {
        _tail.setLength(byteLength);
        _bufferSize += byteLength;

        TempBuffer tempBuf = TempBuffer.allocate();
        _tail.setNext(tempBuf);
        _tail = tempBuf;

        _tailByteBuffer = _tail.getBuffer();
        byteLength = 0;
View Full Code Here

    }
    else {
      _tail.setLength(offset);
      _bufferSize += offset;

      TempBuffer tempBuf = TempBuffer.allocate();
      _tail.setNext(tempBuf);
      _tail = tempBuf;

      _tailByteBuffer = _tail.getBuffer();
      _tailByteLength = 0;
View Full Code Here

    _bufferSize += _tailByteLength;
    _tailByteLength = 0;
   
    writeHeaders(_bufferSize);

    TempBuffer ptr = _head;
    do {
      TempBuffer next = ptr.getNext();
      ptr.setNext(null);

      writeNext(ptr.getBuffer(), 0, ptr.getLength(), isFinished);

      if (ptr != _head) {
View Full Code Here

        Path tempFile = tempDir.createTempFile("form", ".tmp");
        request.addCloseOnExit(tempFile);

        WriteStream os = tempFile.openWrite();

  TempBuffer tempBuffer = TempBuffer.allocate();
  byte []buf = tempBuffer.getBuffer();

  int totalLength = 0;

        try {
    int len;
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

    }
   
    void writeData(Env env, OutputStream os)
      throws IOException
    {
      TempBuffer tempBuf = null;
     
      try {
       tempBuf = TempBuffer.allocate();
        byte []buf = tempBuf.getBuffer();
     
        ReadStream is = _path.openRead();
       
        int len;
        while ((len = is.read(buf, 0, buf.length)) > 0) {
View Full Code Here

   * Append from an input stream, using InputStream.read semantics,
   * i.e. just call is.read once even if more data is available.
   */
  public int appendRead(InputStream is, long length)
  {
    TempBuffer tBuf = TempBuffer.allocate();

    try {
      byte []buffer = tBuf.getBuffer();
      int sublen = buffer.length;
      if (length < sublen)
        sublen = (int) length;

      sublen = is.read(buffer, 0, sublen);
View Full Code Here

   * Append from an input stream, reading from the input stream until
   * end of file or the length is reached.
   */
  public int appendReadAll(InputStream is, long length)
  {
    TempBuffer tBuf = TempBuffer.allocate();

    try {
      byte []buffer = tBuf.getBuffer();
      int readLength = 0;

      while (length > 0) {
        int sublen = buffer.length;
        if (length < 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.