public static StreamInput wrap(byte[] bytes, int offset, int length) { return new InputStreamStreamInput(new ByteArrayInputStream(bytes, offset, length), length); }
public void close() throws IOException { try { super.close(); } finally { if (closed.compareAndSet(false, true)) { // important to release native memory inflater.end(); } } } };
InputStreamStreamInput headerStream = new InputStreamStreamInput(java.nio.channels.Channels.newInputStream(channel)); // don't close byte b1 = headerStream.readByte(); if (b1 == LUCENE_CODEC_HEADER_BYTE) { byte b2 = headerStream.readByte(); byte b3 = headerStream.readByte(); byte b4 = headerStream.readByte(); assert checkpoint.numOps >= 0 : "expected at least 0 operatin but got: " + checkpoint.numOps; assert checkpoint.offset <= channel.size() : "checkpoint is inconsistent with channel length: " + channel.size() + " " + checkpoint; int len = headerStream.readInt(); if (len > channel.size()) { throw new TranslogCorruptedException("uuid length can't be larger than the translog"); headerStream.read(ref.bytes, ref.offset, ref.length); BytesRef uuidBytes = new BytesRef(translogUUID); if (uuidBytes.bytesEquals(ref) == false) {
InputStreamStreamInput headerStream = new InputStreamStreamInput(Channels.newInputStream(channel)); // don't close byte b1 = headerStream.readByte(); if (b1 == LUCENE_CODEC_HEADER_BYTE) { byte b2 = headerStream.readByte(); byte b3 = headerStream.readByte(); byte b4 = headerStream.readByte(); assert checkpoint.numOps > TranslogReader.UNKNOWN_OP_COUNT: "expected at least 0 operatin but got: " + checkpoint.numOps; assert checkpoint.offset <= channel.size() : "checkpoint is inconsistent with channel length: " + channel.size() + " " + checkpoint; int len = headerStream.readInt(); if (len > channel.size()) { throw new TranslogCorruptedException("uuid length can't be larger than the translog"); headerStream.read(ref.bytes, ref.offset, ref.length); BytesRef uuidBytes = new BytesRef(translogUUID); if (uuidBytes.bytesEquals(ref) == false) {
new InputStreamStreamInput(java.nio.channels.Channels.newInputStream(channel), channel.size()), path.toString()); final int version;
public void close() throws IOException { try { super.close(); } finally { if (closed == false) { // important to release native memory inflater.end(); closed = true; } } } };
public static StreamInput wrap(byte[] bytes, int offset, int length) { return new InputStreamStreamInput(new ByteArrayInputStream(bytes, offset, length)); } }
public void close() throws IOException { try { super.close(); } finally { if (closed.compareAndSet(false, true)) { // important to release native memory inflater.end(); } } } };
public static StreamInput wrap(byte[] bytes, int offset, int length) { return new InputStreamStreamInput(new ByteArrayInputStream(bytes, offset, length), length); }
public void close() throws IOException { try { super.close(); } finally { if (closed.compareAndSet(false, true)) { // important to release native memory inflater.end(); } } } };
public static StreamInput wrap(byte[] bytes, int offset, int length) { return new InputStreamStreamInput(new ByteArrayInputStream(bytes, offset, length)); }
public void close() throws IOException { try { super.close(); } finally { if (closed.compareAndSet(false, true)) { // important to release native memory inflater.end(); } } } };
public static StreamInput wrap(byte[] bytes, int offset, int length) { return new InputStreamStreamInput(new ByteArrayInputStream(bytes, offset, length), length); }
@Override protected void doRun() throws Exception { StreamInput input = new InputStreamStreamInput(new BufferedInputStream(activeChannel.getInputStream())); // There is a (slim) chance that we get interrupted right after a loop iteration, so check explicitly while (isOpen.get() && !Thread.currentThread().isInterrupted()) { cancellableThreads.executeIO(() -> readMessage(MockChannel.this, input)); } } });
new InputStreamStreamInput(java.nio.channels.Channels.newInputStream(channel), channel.size()), path.toString()); final int version;
new BufferedChecksumStreamInput(new InputStreamStreamInput(java.nio.channels.Channels.newInputStream(channel), channel.size())); final int version; try {
try (InputStream in = new ByteArrayInputStream(qbSource.bytes, qbSource.offset, qbSource.length)) { try (StreamInput input = new NamedWriteableAwareStreamInput( new InputStreamStreamInput(in, qbSource.length), registry)) { input.setVersion(indexVersion);
try (InputStream in = new ByteArrayInputStream(qbSource.bytes, qbSource.offset, qbSource.length)) { try (StreamInput input = new NamedWriteableAwareStreamInput( new InputStreamStreamInput(in, qbSource.length), registry)) { input.setVersion(indexVersion);