view src/fdl/ByteBufferReader.java @ 24:35375016b2f0 simple-test-passed

cleanup.
author kono
date Wed, 20 Aug 2008 10:18:05 +0900
parents 083a0b5e12cc
children
line wrap: on
line source


package fdl;

import java.io.*;
import java.io.IOException;
import java.nio.*;

public class ByteBufferReader extends Reader {
	public ByteBuffer _buf;
	
	public ByteBufferReader(ByteBuffer buf) {
		_buf = buf;
		_buf.reset();
	}
	
	@Override
	public int read(char[] cbuf, int off, int len) throws IOException {
		for(int i=0;i<len;i++) {
			cbuf[i]=_buf.getChar();
		}
		return len;
	}
	
	@Override
	public void reset() {
		_buf.reset();
	}
	
	@Override
	public void close() throws IOException {

	}

}