2 * Copyright (c) 2007 Yahoo! Inc. All rights reserved.
3 * See accompanying LICENSE file.
5 package com
.yahoo
.pig
.impl
.io
;
7 import java
.io
.FilterInputStream
;
8 import java
.io
.IOException
;
9 import java
.io
.InputStream
;
12 * A simple filter stream that keeps track of the position. It is not at
13 * all specific to Pig, but the need for it arises when implementing LoadFuncs.
18 public class InputStreamPosition
extends FilterInputStream
{
22 * Creates a InputStream filter for the given InputStream with
23 * the given initial position.
25 public InputStreamPosition(InputStream in
, long pos
) {
29 public synchronized void mark(int readlimit
) {
30 super.mark(readlimit
);
33 public int read() throws IOException
{
38 public int read(byte[] b
, int off
, int len
) throws IOException
{
39 int rc
= super.read(b
, off
, len
);
45 public synchronized void reset() throws IOException
{
49 public long skip(long n
) throws IOException
{
50 long rc
= super.skip(n
);
56 * Returns the current position in the tracked InputStream.
58 public long getPosition() {