Skip to content

Commit 934f465

Browse files
hansonrhansonr
authored andcommitted
temp file output fixes
1 parent 87fd2f0 commit 934f465

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

sources/net.sf.j2s.java.core/src/swingjs/JSTempFile.java

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
package swingjs;
22

33
import java.io.File;
4+
import java.io.InputStream;
45

56
public class JSTempFile extends File {
67

7-
final boolean isTemp = true;
8+
public boolean isTempFile() {
9+
return true;
10+
}
811

912
public JSTempFile(File dir, String name) {
1013
super(dir, name);
@@ -23,6 +26,23 @@ public void deleteOnExit() {
2326
public void cacheBytes() {
2427
JSUtil.cacheFileData(path, _bytes);
2528
}
29+
30+
public boolean setBytes(Object isOrBytes) {
31+
if (isOrBytes instanceof InputStream) {
32+
_bytes = /**
33+
* @j2sNative (isOrBytes.$in.$in || isOrBytes.$in).buf ||
34+
*/
35+
null;
36+
} else if (isOrBytes instanceof byte[]) {
37+
_bytes = /**
38+
* @j2sNative isOrBytes ||
39+
*/
40+
null;
41+
} else {
42+
_bytes = null;
43+
}
44+
return _bytes != null;
45+
}
2646

2747

2848
}

0 commit comments

Comments
 (0)