public int readChunk( byte[] buffer, int off, int len ) throws IOException {
		int z;
		if( chunkLeft == 0 ) {
			// Then read the next one!
			String[] c = readCmd();
			if( c.length == 0 ) {
				throw new IOException("Zero-length command!");
			}
			if( "end-chunks".equals(c[0]) ) {
				return -1;
			}
			if( !"chunk".equals(c[0]) ) {
				throw new IOException("Not a chunk! "+c[0]);
			}
			chunkLeft = Integer.parseInt(c[1]);
			if( chunkLeft == 0 ) {
				throw new IOException("Command stream contains zero-length chunk, which is not allowed!");
			}
		}
		z = is.read(buffer, off, Math.min( len, chunkLeft ) );
		if( z == -1 ) throw new IOException("Hit end of stream while reading chunk");
		chunkLeft -= z;
		return z;
	}