@Override public int read(byte[] b, int off, int len) throws IOException { return inputStream.read(b, off, len); }
@Override public int read(byte[] b, int off, int len) throws IOException { return stream.read(b, off, len); }
@Override public int read() throws IOException { return inputStream.read(); }
@Override public int read(byte[] b) throws IOException { return inputStream.read(b); }
@Override public int read() throws IOException { try { return originalStream.read(); } catch (IOException e) { handleIOException(e); return 0; // silence the compiler } }
@Override public int read(byte[] b) throws IOException { try { return originalStream.read(b); } catch (IOException e) { handleIOException(e); return 0; // silence the compiler } }
@Override public int read(byte[] b, int off, int len) throws IOException { try { return originalStream.read(b, off, len); } catch (IOException e) { handleIOException(e); return 0; // silence the compiler } }
@Override public int read() throws IOException { if (closed) { throw new IOException("Stream closed"); } return original.read(); }
@Override public byte[] nextRecord(byte[] reuse) throws IOException { int read = this.stream.read(); if (read == -1) throw new IllegalStateException(); return new byte[]{(byte) read}; }
private Map<Path, String> getFileContentByPath(Path directory) throws Exception { Map<Path, String> contents = new HashMap<>(); final FileStatus[] filesInBucket = getFileSystem().listStatus(directory); for (FileStatus file : filesInBucket) { final long fileLength = file.getLen(); byte[] serContents = new byte[(int) fileLength]; FSDataInputStream stream = getFileSystem().open(file.getPath()); stream.read(serContents); contents.put(file.getPath(), new String(serContents, StandardCharsets.UTF_8)); } return contents; }
final int available = 17; final boolean markSupported = true; when(mockIn.read()).thenReturn(value); when(mockIn.read(any(byte[].class), anyInt(), anyInt())).thenReturn(11); when(mockIn.getPos()).thenReturn(inPos); when(mockIn.available()).thenReturn(available); assertEquals(value, in.read()); assertEquals(bytesRead, in.read(new byte[11], 2, 5));
@Override public void go() throws Exception { try (FSDataInputStream stream = fs.open(path)) { assertTrue(fs.getNumberOfOpenInputStreams() <= maxConcurrentInputStreams); assertTrue(fs.getTotalNumberOfOpenStreams() <= maxConcurrentStreamsTotal); final byte[] readBuffer = new byte[4096]; //noinspection StatementWithEmptyBody while (stream.read(readBuffer) != -1) {} } } }
@Override public void go() throws Exception { try (FSDataInputStream stream = fs.open(path)) { assertTrue(fs.getNumberOfOpenInputStreams() <= maxConcurrentInputStreams); assertTrue(fs.getTotalNumberOfOpenStreams() <= maxConcurrentStreamsTotal); final byte[] readBuffer = new byte[(int) fs.getFileStatus(path).getLen() - 1]; assertTrue(stream.read(readBuffer) != -1); waitTillWokenUp(); // try to write one more thing, which might/should fail with an I/O exception //noinspection ResultOfMethodCallIgnored stream.read(); } } }
while (in.read() != -1) { Thread.sleep(5);
int numBytes = inputStream.read(buffer); if (numBytes == -1) { break;
assertEquals(lfsinput2.read(testbytestest), 5); lfsinput2.close(); assertTrue(Arrays.equals(testbytes, testbytestest));
int numBytes = inputStream.read(buffer);
public int read() throws IOException { if (endOffsetExclusive >= 0L && position >= endOffsetExclusive) { return -1; } else { int result = delegate.read(); ++position; return result; } }
public int read() throws IOException { if (endOffsetExclusive >= 0L && position >= endOffsetExclusive) { return -1; } else { int result = delegate.read(); ++position; return result; } }