view src/org/eclipse/jetty/io/JBuffer.java @ 1074:6b7ff30bb990

rename putQ() to put()
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 10 Nov 2016 02:37:15 -0700
parents 6e511ea557b4
children
line wrap: on
line source

// tmp class to implement Buffer until I can get rid of it

package org.eclipse.jetty.io;

import java.io.InputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.eclipse.jetty.util.TypeUtil;


public final class JBuffer {
	private static final Logger LOG = LoggerFactory.getLogger(JBuffer.class);

	private final ByteBuffer bb;

	public JBuffer(ByteBuffer bb) {
		this.bb = bb;
	}

	public int position() {
		return bb.position();
	}

	public void position(int i) {
		bb.position(i);
	}

	public int limit() {
		return bb.limit();
	}

	public void limit(int i) {
		bb.limit(i);
	}

	public byte[] array() {
		return bb.array();
	}

	public boolean hasArray() {
		return bb.hasArray();
	}

	public JBuffer duplicate() {
		return new JBuffer(bb.duplicate());
	}

	public int remaining() {
		return bb.remaining();
	}

	public boolean isReadOnly() {
		return bb.isReadOnly();
	}

	public boolean hasRemaining() {
		return bb.hasRemaining();
	}

	public byte get() {
		return bb.get();
	}

	public void get(byte[] bytes) {
		bb.get(bytes);
	}

	public void compact() {
		bb.compact();
	}

	public int capacity() {
		return bb.capacity();
	}



	public ByteBuffer getByteBuffer() {
		return bb;
	}

	public void clear() {
		bb.clear();
	}


	public void get(byte[] b, int offset, int length) {
		bb.get(b,offset,length);
	}


	public void put(JBuffer src) {
		bb.put(src.bb);
	}

	public void put(byte b) {
		bb.put(b);
	}

	public void put(byte[] b) {
		bb.put(b);
	}

/*
	@Override
	public String toString() {
//		return toString("ISO-8859-1");
//		Thread.dumpStack();
		throw new RuntimeException("toString");
	}
*/

	public byte get(int index) {
		return bb.get(index);
	}

	public void flip() {
		bb.flip();
	}

}