public ChannelProxy sharedCopy() { return new ChannelProxy(this); }
public ChannelProxy sharedCopy() { return new ChannelProxy(this); }
public ChannelProxy sharedCopy() { return new ChannelProxy(this); }
@SuppressWarnings("resource") public static ChecksummedDataInput open(File file) { return new ChecksummedDataInput(new ChannelProxy(file)); }
@SuppressWarnings("resource") public static ChecksummedDataInput open(File file) { return new ChecksummedDataInput(new ChannelProxy(file)); }
@SuppressWarnings("resource") public static ChecksummedDataInput open(File file) { return new ChecksummedDataInput(new ChannelProxy(file)); }
public ChannelProxy sharedCopy() { try { FSDataInputStream inputStream = HadoopFileUtils.buildInputStream(this.fs, this.filePath, this.bufferSize); Cleanup cleanup = new Cleanup(this.filePath(), inputStream); return new ChannelProxy(cleanup, this.fs, inputStream, this.filePath, this.bufferSize); } catch (IOException e) { e.printStackTrace(); //TODO: using logging throw new RuntimeException((e.getCause())); } }
public static ChannelProxy getInstance(String filePath, int bufferSize) { filePath = HadoopFileUtils.normalizeFileName(filePath); try { Path path = new Path(filePath); FileSystem fs = path.getFileSystem(CONF); FSDataInputStream inputStream = HadoopFileUtils.buildInputStream(path, bufferSize); Cleanup cleanup = new Cleanup(filePath, inputStream); return new ChannelProxy(cleanup, fs, inputStream, path, bufferSize); } catch (IOException e) { e.printStackTrace(); //TODO: using logging return null; } }
@SuppressWarnings("resource") // Closing the ChecksummedDataInput will close the underlying channel. public static ChecksummedDataInput upgradeInput(ChecksummedDataInput input, ICompressor compressor) { long position = input.getPosition(); input.close(); return new CompressedChecksummedDataInput(new ChannelProxy(input.getPath()), compressor, position); }
@SuppressWarnings("resource") public static ChecksummedDataInput upgradeInput(ChecksummedDataInput input, Cipher cipher, ICompressor compressor) { long position = input.getPosition(); input.close(); return new EncryptedChecksummedDataInput(new ChannelProxy(input.getPath()), cipher, compressor, position); }
@SuppressWarnings("resource") // Closing the ChecksummedDataInput will close the underlying channel. public static ChecksummedDataInput upgradeInput(ChecksummedDataInput input, ICompressor compressor) { long position = input.getPosition(); input.close(); return new CompressedChecksummedDataInput(new ChannelProxy(input.getPath()), compressor, position); }
@SuppressWarnings("resource") public static ChecksummedDataInput upgradeInput(ChecksummedDataInput input, Cipher cipher, ICompressor compressor) { long position = input.getPosition(); input.close(); return new EncryptedChecksummedDataInput(new ChannelProxy(input.getPath()), cipher, compressor, position); }
@SuppressWarnings("resource") public static ChecksummedDataInput upgradeInput(ChecksummedDataInput input, Cipher cipher, ICompressor compressor) { long position = input.getPosition(); input.close(); return new EncryptedChecksummedDataInput(new ChannelProxy(input.getPath()), cipher, compressor, position); }
@SuppressWarnings("resource") // Closing the ChecksummedDataInput will close the underlying channel. public static ChecksummedDataInput upgradeInput(ChecksummedDataInput input, ICompressor compressor) { long position = input.getPosition(); input.close(); return new CompressedChecksummedDataInput(new ChannelProxy(input.getPath()), compressor, position); }
@SuppressWarnings("resource") // The Rebufferer owns both the channel and the validator and handles closing both. public static RandomAccessReader open(File file, File crcFile) throws IOException { ChannelProxy channel = new ChannelProxy(file); try { DataIntegrityMetadata.ChecksumValidator validator = new DataIntegrityMetadata.ChecksumValidator(ChecksumType.CRC32, RandomAccessReader.open(crcFile), file.getPath()); Rebufferer rebufferer = new ChecksummedRebufferer(channel, validator); return new RandomAccessReader.RandomAccessReaderWithOwnChannel(rebufferer); } catch (Throwable t) { channel.close(); throw t; } } }
@SuppressWarnings("resource") // The Rebufferer owns both the channel and the validator and handles closing both. public static RandomAccessReader open(File file, File crcFile) throws IOException { ChannelProxy channel = new ChannelProxy(file); try { DataIntegrityMetadata.ChecksumValidator validator = new DataIntegrityMetadata.ChecksumValidator(ChecksumType.CRC32, RandomAccessReader.open(crcFile), file.getPath()); Rebufferer rebufferer = new ChecksummedRebufferer(channel, validator); return new RandomAccessReader.RandomAccessReaderWithOwnChannel(rebufferer); } catch (Throwable t) { channel.close(); throw t; } } }
@SuppressWarnings("resource") // The Rebufferer owns both the channel and the validator and handles closing both. public static RandomAccessReader open(File file, File crcFile) throws IOException { ChannelProxy channel = new ChannelProxy(file); try { DataIntegrityMetadata.ChecksumValidator validator = new DataIntegrityMetadata.ChecksumValidator(ChecksumType.CRC32, RandomAccessReader.open(crcFile), file.getPath()); Rebufferer rebufferer = new ChecksummedRebufferer(channel, validator); return new RandomAccessReader.RandomAccessReaderWithOwnChannel(rebufferer); } catch (Throwable t) { channel.close(); throw t; } } }
/** * Open a RandomAccessReader (not compressed, not mmapped, no read throttling) that will own its channel. * * @param file File to open for reading * @return new RandomAccessReader that owns the channel opened in this method. */ @SuppressWarnings("resource") public static RandomAccessReader open(File file) { ChannelProxy channel = new ChannelProxy(file); try { ChunkReader reader = new SimpleChunkReader(channel, -1, BufferType.OFF_HEAP, DEFAULT_BUFFER_SIZE); Rebufferer rebufferer = reader.instantiateRebufferer(); return new RandomAccessReaderWithOwnChannel(rebufferer); } catch (Throwable t) { channel.close(); throw t; } } }
/** * Open a RandomAccessReader (not compressed, not mmapped, no read throttling) that will own its channel. * * @param file File to open for reading * @return new RandomAccessReader that owns the channel opened in this method. */ @SuppressWarnings("resource") public static RandomAccessReader open(File file) { ChannelProxy channel = new ChannelProxy(file); try { ChunkReader reader = new SimpleChunkReader(channel, -1, BufferType.OFF_HEAP, DEFAULT_BUFFER_SIZE); Rebufferer rebufferer = reader.instantiateRebufferer(); return new RandomAccessReaderWithOwnChannel(rebufferer); } catch (Throwable t) { channel.close(); throw t; } } }
/** * Open a RandomAccessReader (not compressed, not mmapped, no read throttling) that will own its channel. * * @param file File to open for reading * @return new RandomAccessReader that owns the channel opened in this method. */ @SuppressWarnings("resource") public static RandomAccessReader open(File file) { ChannelProxy channel = new ChannelProxy(file); try { ChunkReader reader = new SimpleChunkReader(channel, -1, BufferType.OFF_HEAP, DEFAULT_BUFFER_SIZE); Rebufferer rebufferer = reader.instantiateRebufferer(); return new RandomAccessReaderWithOwnChannel(rebufferer); } catch (Throwable t) { channel.close(); throw t; } } }