01: /* Copyright (C) 2003 Internet Archive.
02: *
03: * This file is part of the Heritrix web crawler (crawler.archive.org).
04: *
05: * Heritrix is free software; you can redistribute it and/or modify
06: * it under the terms of the GNU Lesser Public License as published by
07: * the Free Software Foundation; either version 2.1 of the License, or
08: * any later version.
09: *
10: * Heritrix is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13: * GNU Lesser Public License for more details.
14: *
15: * You should have received a copy of the GNU Lesser Public License
16: * along with Heritrix; if not, write to the Free Software
17: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18: *
19: * RandomAccessOutputStream.java
20: * Created on May 21, 2004
21: *
22: * $Header$
23: */
24: package org.archive.io;
25:
26: import java.io.IOException;
27: import java.io.OutputStream;
28: import java.io.RandomAccessFile;
29:
30: /**
31: * Wraps a RandomAccessFile with OutputStream interface.
32: *
33: * @author gojomo
34: */
35: public class RandomAccessOutputStream extends OutputStream {
36: RandomAccessFile raf;
37:
38: /**
39: * Wrap the given RandomAccessFile
40: */
41: public RandomAccessOutputStream(RandomAccessFile raf) {
42: super ();
43: this .raf = raf;
44: }
45:
46: /* (non-Javadoc)
47: * @see java.io.OutputStream#write(int)
48: */
49: public void write(int b) throws IOException {
50: raf.write(b);
51: }
52:
53: /* (non-Javadoc)
54: * @see java.io.OutputStream#close()
55: */
56: public void close() throws IOException {
57: raf.close();
58: }
59:
60: /* (non-Javadoc)
61: * @see java.io.OutputStream#write(byte[], int, int)
62: */
63: public void write(byte[] b, int off, int len) throws IOException {
64: raf.write(b, off, len);
65: }
66:
67: /* (non-Javadoc)
68: * @see java.io.OutputStream#write(byte[])
69: */
70: public void write(byte[] b) throws IOException {
71: raf.write(b);
72: }
73: }
|