function Archiver() { var temperature = null; var archive = []; Object.defineProperty(this, 'temperature', { get: function() { console.log('get!'); return temperature; }, set: function(value) { temperature = value; archive.push({ val: temperature }); } }); this.getArchive = function() { return archive; }; } var arc = new Archiver(); arc.temperature; // 'get!' arc.temperature = 11; arc.temperature = 13; arc.getArchive(); // [{ val: 11 }, { val: 13 }]
private void addFile(final Path subPath) throws IOException { zipWriter.addFile(getZipEntry(subPath), ioService.newInputStream(subPath)); }
@Test public void testFewFolders() throws Exception { assertEquals("hello/file.txt", Archiver.FileNameResolver.resolve("project/hello/file.txt", "project/hello")); }
public void close() throws IOException { zipWriter.close(); } }
public TestJarWriter( final File file, final TempFiles tempFiles ) throws IOException { this.tempFiles = tempFiles; zipWriter = new ZipWriter( new FileOutputStream( file ) ); }
static protected String resolve(final String subPath, final String originalPath) { if ("/".equals(originalPath)) { return subPath.substring(originalPath.length()); } else { String fileSubPath = subPath.substring(originalPath.length()); if (fileSubPath.charAt(0) == '/') { fileSubPath = fileSubPath.substring(1); } return getBaseFolder(originalPath) + fileSubPath; } }
@Test public void testNormal() throws Exception { assertEquals("hello/file.txt", Archiver.FileNameResolver.resolve("hello/file.txt", "hello")); }
private void addFile(final Path subPath) throws IOException { zipWriter.addFile(getZipEntry(subPath), ioService.newInputStream(subPath)); }
function Archiver() { var temperature = null; var archive = []; Object.defineProperty(this, 'temperature', { get: function() { console.log('get!'); return temperature; }, set: function(value) { console.log("set:"+value); temperature = value; archive.push({ val: temperature }); } }); this.getArchive = function() { return archive; }; } var arc = new Archiver(); arc.temperature; // 'get!' arc.temperature = 11; arc.temperature = 13; arc.getArchive(); // [{ val: 11 }, { val: 13 }]
static protected String resolve(final String subPath, final String originalPath) { if ("/".equals(originalPath)) { return subPath.substring(originalPath.length()); } else { return getBaseFolder(originalPath) + subPath.substring(originalPath.length() + 1); } }
@Test public void testRootFolder() throws Exception { assertEquals("/file.txt", Archiver.FileNameResolver.resolve("/project/file.txt", "/project/")); } }
function Archiver() { var temperature = null; var archive = []; Object.defineProperty(this, 'temperature', { get: function () { console.log('get!'); return temperature; }, set: function (value) { temperature = value; archive.push({ val: temperature }); } }); this.getArchive = function () { return archive; }; } var arc = new Archiver(); arc.temperature; // 'get!' arc.temperature = 11; arc.temperature = 13; arc.getArchive(); // [{ val: 11 }, { val: 13 }]
@Test public void testNormal() throws Exception { assertEquals("hello/file.txt", Archiver.FileNameResolver.resolve("hello/file.txt", "hello")); }
@Test public void testRootFolder() throws Exception { assertEquals("/file.txt", Archiver.FileNameResolver.resolve("/project/file.txt", "/project/")); } }