-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PEP on output stream #144
Comments
seems to work here... ref IRODSFileOutputStreamTest in jargon core.re
@Test
public final void testIRODSFileOutputStreamOverwrite() throws Exception {
String testFileName = "testIRODSFileOutputStreamOverwrite.txt";
String string1 = "jfaijfjasidjfaisehfuaehfahfhudhfuashfuasfdhaisdfhaisdhfiaf";
String string2 = "nvmzncvzmvnzx,mcv";
String absPath = scratchFileUtils
.createAndReturnAbsoluteScratchPath(IRODS_TEST_SUBDIR_PATH);
String localFilePath = FileGenerator
.generateFileOfFixedLengthGivenName(absPath, testFileName, 8);
new File(localFilePath);
String targetIrodsCollection = testingPropertiesHelper
.buildIRODSCollectionAbsolutePathFromTestProperties(
testingProperties, IRODS_TEST_SUBDIR_PATH);
IRODSAccount irodsAccount = testingPropertiesHelper
.buildIRODSAccountFromTestProperties(testingProperties);
IRODSAccessObjectFactory accessObjectFactory = irodsFileSystem
.getIRODSAccessObjectFactory();
IRODSFileFactory irodsFileFactory = accessObjectFactory
.getIRODSFileFactory(irodsAccount);
IRODSFile irodsFile = irodsFileFactory
.instanceIRODSFile(targetIrodsCollection + '/' + testFileName);
IRODSFileOutputStream irodsFileOutputStream = irodsFileFactory
.instanceIRODSFileOutputStream(irodsFile);
irodsFileOutputStream.write(string1.getBytes());
irodsFileOutputStream.close();
irodsFileOutputStream = irodsFileFactory.instanceIRODSFileOutputStream(
irodsFile, OpenFlags.WRITE_TRUNCATE);
irodsFileOutputStream.write(string2.getBytes());
irodsFileOutputStream.close();
IRODSFileInputStream irodsFileInputStream = irodsFileFactory
.instanceIRODSFileInputStream(irodsFile);
String actual = MiscIRODSUtils
.convertStreamToString(irodsFileInputStream);
irodsFileInputStream.close();
Assert.assertEquals("should be second string", string2, actual);
}
in test, these lines: IRODSFileOutputStream irodsFileOutputStream = irodsFileFactory
.instanceIRODSFileOutputStream(irodsFile);
irodsFileOutputStream.write(string1.getBytes());
irodsFileOutputStream.close(); yield
Then these subsequent lines irodsFileOutputStream = irodsFileFactory.instanceIRODSFileOutputStream(
irodsFile, OpenFlags.WRITE_TRUNCATE);
irodsFileOutputStream.write(string2.getBytes());
irodsFileOutputStream.close(); again yield
|
If verified that if the file exists before the output stream is opened with |
thanks! I'm on it. |
this is linked to #146. |
retest with 4.1.6 before release |
If you use the method, IRODSFileFactory.instanceIRODSFileOutputStream(file, DataObjInp.OpenFlags.WRITE_TRUNCATE), the acPostProcOnPut rule isn't fired.
via tony
The text was updated successfully, but these errors were encountered: