code cleanup + BufInputStream.is()