This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
outputStream = new DeflaterOutputStream(outputStream, new Deflater(), BLOCK_SIZE) { | |
@Override | |
public void close() throws IOException { | |
try { | |
super.close(); | |
} finally { | |
def.end(); | |
} | |
} | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public GZIPOutputStream(OutputStream out, int size, boolean syncFlush) | |
throws IOException | |
{ | |
super(out, new Deflater(Deflater.DEFAULT_COMPRESSION, true), | |
size, | |
syncFlush); | |
usesDefaultDeflater = true; | |
writeHeader(); | |
crc.reset(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Java_java_util_zip_Deflater_init(JNIEnv *env, jclass cls, jint level, | |
jint strategy, jboolean nowrap) | |
{ | |
z_stream *strm = calloc(1, sizeof(z_stream)); | |
if (strm == 0) { | |
JNU_ThrowOutOfMemoryError(env, 0); | |
return jlong_zero; | |
} else { | |
char *msg; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected[this] def doPreStart(): Unit = | |
isOpt = ftpLike match { | |
case ro: RetrieveOffset => | |
Some(ro.retrieveFileInputStream(path, handler.get.asInstanceOf[ro.Handler], offset).get) | |
case _ => | |
Some(ftpLike.retrieveFileInputStream(path, handler.get).get) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected[this] def doPreStart(): Unit = | |
isOpt = ftpLike match { | |
case ur: UnconfirmedReads => | |
withUnconfirmedReads(ur) | |
case ro: RetrieveOffset => | |
Some(ro.retrieveFileInputStream(path, handler.get.asInstanceOf[ro.Handler], offset).get) | |
case _ => | |
Some(ftpLike.retrieveFileInputStream(path, handler.get).get) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private LocalDestFile downloadFile(final StreamCopier.Listener listener, | |
final RemoteResourceInfo remote, | |
final LocalDestFile local) | |
throws IOException { | |
final LocalDestFile adjusted = local.getTargetFile(remote.getName()); | |
final RemoteFile rf = engine.open(remote.getPath()); | |
try { | |
final RemoteFile.ReadAheadRemoteFileInputStream rfis = rf.new ReadAheadRemoteFileInputStream(16); | |
final OutputStream os = adjusted.getOutputStream(); | |
try { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def retrieveFileInputStream(name: String, handler: Handler, offset: Long): Try[InputStream] = | |
Try { | |
val remoteFile = handler.open(name, java.util.EnumSet.of(OpenMode.READ)) | |
val is = new remoteFile.RemoteFileInputStream(offset) { | |
override def close(): Unit = | |
try { | |
super.close() | |
} finally { | |
remoteFile.close() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def retrieveFileInputStream(name: String, | |
handler: Handler, | |
offset: Long, | |
maxUnconfirmedReads: Int): Try[InputStream] = | |
Try { | |
val remoteFile = handler.open(name, java.util.EnumSet.of(OpenMode.READ)) | |
val is = maxUnconfirmedReads match { | |
case m if m > 1 => | |
new remoteFile.ReadAheadRemoteFileInputStream(m, offset) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
latency: 0ms | |
------------------ | |
64 reads: 32683ms | |
32 reads: 35815ms | |
16 reads: 35298ms | |
8 reads: 38902ms | |
latency: 20ms | |
------------------ | |
64 reads: 42407ms |
OlderNewer