Package com.google.code.hs4j.network.buffer

Examples of com.google.code.hs4j.network.buffer.IoBuffer.flip()


    assertEquals("P\t1\tmytest\tuser\tINDEX_1\tid,name,password\n",
        new String(buf.array(), 0, buf.limit()));

    IoBuffer buffer = IoBuffer.allocate(4);
    buffer.put("0\t1\n".getBytes());
    buffer.flip();

    assertEquals(1, this.cmd.getLatch().getCount());
    assertTrue(this.cmd.decode(null, buffer));
    assertEquals(0, this.cmd.getResponseStatus());
    assertEquals(1, this.cmd.getNumColumns());
View Full Code Here


    assertEquals("P\t1\tmytest\tuser\tINDEX_1\tid,name,password\tage,name\n",
        new String(buf.array(), 0, buf.limit()));

    IoBuffer buffer = IoBuffer.allocate(4);
    buffer.put("0\t1\n".getBytes());
    buffer.flip();

    assertEquals(1, cmd.getLatch().getCount());
    assertTrue(cmd.decode(null, buffer));
    assertEquals(0, cmd.getResponseStatus());
    assertEquals(1, cmd.getNumColumns());
View Full Code Here

    assertEquals("1\t+\t3\t1\tdennis\tpassword\n", new String(buf.array(),
        0, buf.limit()));

    IoBuffer buffer = IoBuffer.allocate(4);
    buffer.put("0\t1\n".getBytes());
    buffer.flip();

    assertEquals(1, this.cmd.getLatch().getCount());
    assertTrue(this.cmd.decode(null, buffer));
    assertEquals(0, this.cmd.getResponseStatus());
    assertEquals(1, this.cmd.getNumColumns());
View Full Code Here

      byte[] bytes = new byte[buff.remaining()];
      buff.get(bytes);
      IoBuffer result = IoBuffer.allocate(bytes.length,
          ByteBufferCodecFactory.this.direct);
      result.put(bytes);
      result.flip();
      return result;
    }

  }
View Full Code Here

      byte[] bytes = new byte[msgBuffer.remaining()];
      msgBuffer.get(bytes);
      IoBuffer result = IoBuffer.allocate(bytes.length,
          ByteBufferCodecFactory.this.direct);
      result.put(bytes);
      result.flip();
      return result;
    }

  }
View Full Code Here

      // filter value
      this.writeToken(buf, fval[i]);
    }
    this.writeCommandTerminate(buf);

    buf.flip();
    this.buffer = buf;
  }
}
View Full Code Here

        this.writeCommandTerminate(buf);
      } else {
        this.writeTokenSeparator(buf);
      }
    }
    buf.flip();
    this.buffer = buf;

  }

}
View Full Code Here

      } else {
        this.writeTokenSeparator(buf);
      }
    }

    buf.flip();
    this.buffer = buf;
  }
}
View Full Code Here

    }else{
      this.writeCommandTerminate(buf);

    }

    buf.flip();

    this.buffer = buf;
  }

}
View Full Code Here

            String message = (String) msg;
            ByteBuffer buff = TextLineCodecFactory.this.charset.encode(message);
            IoBuffer resultBuffer = IoBuffer.allocate(buff.remaining() + SPLIT.remaining());
            resultBuffer.put(buff);
            resultBuffer.put(SPLIT.slice());
            resultBuffer.flip();
            return resultBuffer;
        }
    }

    private Encoder encoder = new StringEncoder();
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.