Class DfsOutputStream
java.lang.Object
java.io.OutputStream
org.eclipse.jgit.internal.storage.dfs.DfsOutputStream
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
- Direct Known Subclasses:
InMemoryRepository.Out
Output stream to create a file on the DFS.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
Get the recommended alignment for writing.abstract int
read
(long position, ByteBuffer buf) Read back a portion of already written data.abstract void
write
(byte[] buf, int off, int len) void
write
(int b) Methods inherited from class java.io.OutputStream
close, flush, write
-
Constructor Details
-
DfsOutputStream
public DfsOutputStream()
-
-
Method Details
-
blockSize
public int blockSize()Get the recommended alignment for writing.Starting a write at multiples of the blockSize is more efficient than starting a write at any other position. If 0 or -1 the channel does not have any specific block size recommendation.
Channels should not recommend large block sizes. Sizes up to 1-4 MiB may be reasonable, but sizes above that may be horribly inefficient.
- Returns:
- recommended alignment size for randomly positioned reads. Does not need to be a power of 2.
-
write
- Specified by:
write
in classOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
read
Read back a portion of already written data.The writing position of the output stream is not affected by a read.
- Parameters:
position
- offset to read from.buf
- buffer to populate. Up tobuf.remaining()
bytes will be read fromposition
.- Returns:
- number of bytes actually read.
- Throws:
IOException
- reading is not supported, or the read cannot be performed due to DFS errors.
-