• R/O
  • SSH
  • HTTPS

hoge: Commit


Commit MetaInfo

Revision57 (tree)
Zeit2007-03-09 13:19:21
Autorgn64_jp

Log Message

(empty log message)

Ändern Zusammenfassung

Diff

--- hoge/tofu/src/hoge/tofu/object/CommonStream.java (nonexistent)
+++ hoge/tofu/src/hoge/tofu/object/CommonStream.java (revision 57)
@@ -0,0 +1,47 @@
1+/*
2+ * CommonStream.java
3+ *
4+ * Created on 2007/03/06, 10:21
5+ *
6+ * Hoge Project Tofu Library Assist making java app.
7+ * Copyright (C) 2006-2007 gn64_jp
8+ *
9+ * This library is free software; you can redistribute it and/or
10+ * modify it under the terms of the GNU Lesser General Public
11+ * License as published by the Free Software Foundation;
12+ * version 2.1 of the License.
13+ *
14+ * This library is distributed in the hope that it will be useful,
15+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17+ * Lesser General Public License for more details.
18+ *
19+ * You should have received a copy of the GNU Lesser General Public
20+ * License along with this library; if not, write to the Free Software
21+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22+ *
23+ */
24+
25+package hoge.tofu.object;
26+
27+import java.io.InputStream;
28+
29+/**
30+ * @version 0.1
31+ * @author gn64_jp
32+ */
33+public class CommonStream {
34+ InputStream is=null;
35+ String type;
36+ /** Creates a new instance of CommonStream */
37+ public CommonStream(String streamtype,InputStream value) {
38+ type=streamtype;
39+ is=value;
40+ }
41+ public InputStream getInputStream(){
42+ return is;
43+ }
44+ public String getStreamtype(){
45+ return type;
46+ }
47+}
--- hoge/tofu/src/hoge/tofu/object/CommonStreamInput.java (nonexistent)
+++ hoge/tofu/src/hoge/tofu/object/CommonStreamInput.java (revision 57)
@@ -0,0 +1,85 @@
1+/*
2+ * TFCommonInputStream.java
3+ *
4+ * Created on 2007/03/05, 13:09
5+ *
6+ * Hoge Project Tofu Library Assist making java app.
7+ * Copyright (C) 2006-2007 gn64_jp
8+ *
9+ * This library is free software; you can redistribute it and/or
10+ * modify it under the terms of the GNU Lesser General Public
11+ * License as published by the Free Software Foundation;
12+ * version 2.1 of the License.
13+ *
14+ * This library is distributed in the hope that it will be useful,
15+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17+ * Lesser General Public License for more details.
18+ *
19+ * You should have received a copy of the GNU Lesser General Public
20+ * License along with this library; if not, write to the Free Software
21+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22+ *
23+ */
24+
25+package hoge.tofu.object;
26+
27+import java.io.ByteArrayInputStream;
28+import java.io.FilterInputStream;
29+import java.io.IOException;
30+import java.io.InputStream;
31+
32+/**
33+ * byte列からデータのInputStreamを読み出すクラス
34+ * @version 0.1
35+ * @author gn64_jp
36+ */
37+public class CommonStreamInput{
38+ CommonStream cs=null;
39+ String streamtype;
40+ String sep="#Hoge Tofu Library 0.1 CommonInputStream Separate#";
41+ /** Creates a new instance of TFCommonInputStream */
42+ public CommonStreamInput(InputStream sis) throws IOException{
43+ int i=0;
44+ byte[] bf=new byte[sis.available()];
45+ byte[] bend=sep.getBytes("UTF-8");
46+ boolean bo=true;
47+ sis.read(bf);
48+ while(bo){
49+ byte[] bft=new byte[bend.length];
50+ for(int j=0;j<bend.length;j++){
51+ bft[j]=bf[i+j];
52+ }
53+ i++;
54+ int numt=0;
55+ for(int j=0;j<bend.length;j++){
56+ if(bft[j]==bend[j]){
57+ numt++;
58+ }
59+ }
60+ if(numt>bend.length-1){
61+ bo=false;
62+ }
63+ }
64+ bf=null;
65+ byte[] bft=new byte[i];
66+ sis.reset();
67+ sis.read(bft,0,i);
68+ streamtype=new String(bft);
69+ sis.reset();
70+ sis.skip(i+bend.length-1);
71+ byte[] b=new byte[sis.available()];
72+ sis.read(b);
73+ ByteArrayInputStream bis=new ByteArrayInputStream(b);
74+ cs=new CommonStream(streamtype,bis);
75+ }
76+ /**
77+ * データの中身のInputStreamを返すメソッド
78+ */
79+ public CommonStream getCommonStream(){
80+ return cs;
81+ }
82+ public String getSeparator(){
83+ return sep;
84+ }
85+}
--- hoge/tofu/src/hoge/tofu/object/CommonStreamOutput.java (nonexistent)
+++ hoge/tofu/src/hoge/tofu/object/CommonStreamOutput.java (revision 57)
@@ -0,0 +1,85 @@
1+/*
2+ * CommonOutputStream.java
3+ *
4+ * Created on 2007/03/05, 17:04
5+ *
6+ * Hoge Project Tofu Library Assist making java app.
7+ * Copyright (C) 2006-2007 gn64_jp
8+ *
9+ * This library is free software; you can redistribute it and/or
10+ * modify it under the terms of the GNU Lesser General Public
11+ * License as published by the Free Software Foundation;
12+ * version 2.1 of the License.
13+ *
14+ * This library is distributed in the hope that it will be useful,
15+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17+ * Lesser General Public License for more details.
18+ *
19+ * You should have received a copy of the GNU Lesser General Public
20+ * License along with this library; if not, write to the Free Software
21+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22+ *
23+ */
24+
25+package hoge.tofu.object;
26+
27+import java.io.ByteArrayInputStream;
28+import java.io.IOException;
29+import java.io.InputStream;
30+import java.io.OutputStream;
31+
32+/**
33+ * データのInputStreamをbyte列に変換するクラス
34+ * @version 0.1
35+ * @author gn64_jp
36+ */
37+public class CommonStreamOutput {
38+ InputStream is=null;
39+ String streamtype;
40+ String sep="#Hoge Tofu Library 0.1 CommonInputStream Separate#";
41+ /** Creates a new instance of CommonOutputStream */
42+ public CommonStreamOutput(InputStream value,String filetype) throws IOException {
43+ byte[] b=(filetype+sep).getBytes("UTF-8");
44+ byte[] b2 = new byte[value.available()];
45+ byte[] btemp=new byte[b.length+b2.length];
46+ value.read(b2);
47+ for(int i=0;i<btemp.length-1;i++){
48+ if(i>b.length-1){
49+ btemp[i]=b2[i-b.length];
50+ }else{
51+ btemp[i]=b[i];
52+ }
53+ }
54+ ByteArrayInputStream bis=new ByteArrayInputStream(btemp);
55+ is=bis;
56+ }
57+ public CommonStreamOutput(CommonStream cvalue) throws IOException {
58+ String filetype=cvalue.getStreamtype();
59+ InputStream value=cvalue.getInputStream();
60+ byte[] b=(filetype+sep).getBytes("UTF-8");
61+ byte[] b2 = new byte[value.available()];
62+ byte[] btemp=new byte[b.length+b2.length];
63+ value.read(b2);
64+ for(int i=0;i<btemp.length-1;i++){
65+ if(i>b.length-1){
66+ btemp[i]=b2[i-b.length];
67+ }else{
68+ btemp[i]=b[i];
69+ }
70+ }
71+ ByteArrayInputStream bis=new ByteArrayInputStream(btemp);
72+ is=bis;
73+ }
74+ public void write(int b) throws IOException {
75+ byte[] by=new byte[is.available()+1];
76+ is.read(by);
77+ by[by.length-1]=(byte)b;
78+ }
79+ /**
80+ * CommonStreamをInputStreamに変換する
81+ */
82+ public InputStream getInputStream(){
83+ return is;
84+ }
85+}
--- hoge/tofu/src/hoge/tofu/object/XmlInZipTest.java (nonexistent)
+++ hoge/tofu/src/hoge/tofu/object/XmlInZipTest.java (revision 57)
@@ -0,0 +1,61 @@
1+/*
2+ * XmlInZipTest.java
3+ *
4+ * Created on 2007/02/22, 8:58
5+ *
6+ * Hoge Project Tofu Library Assist making java app.
7+ * Copyright (C) 2006-2007 gn64_jp
8+ *
9+ * This library is free software; you can redistribute it and/or
10+ * modify it under the terms of the GNU Lesser General Public
11+ * License as published by the Free Software Foundation;
12+ * version 2.1 of the License.
13+ *
14+ * This library is distributed in the hope that it will be useful,
15+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17+ * Lesser General Public License for more details.
18+ *
19+ * You should have received a copy of the GNU Lesser General Public
20+ * License along with this library; if not, write to the Free Software
21+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22+ *
23+ */
24+
25+package hoge.tofu.object;
26+
27+import java.io.IOException;
28+import java.util.zip.ZipException;
29+import javax.xml.parsers.ParserConfigurationException;
30+import hoge.tofu.object.xml.XmlLoader;
31+import hoge.tofu.object.zip.ZipLoader;
32+import org.xml.sax.SAXException;
33+/**
34+ * @version 0.1
35+ * @author gn64_jp
36+ */
37+public class XmlInZipTest {
38+
39+ /** Creates a new instance of XmlInZipTest */
40+ public XmlInZipTest() {
41+ }
42+ public static void main(String[] args){
43+ ZipLoader zl;
44+ XmlLoader xl;
45+ try {
46+ zl = new ZipLoader("HogeMusic.zip");
47+ xl = new XmlLoader(zl.ZipLoad("config.xml"));
48+ System.out.println("TEST "+xl.getValue("information/name")[0]);
49+
50+ } catch (ZipException ex) {
51+ ex.printStackTrace();
52+ } catch (IOException ex) {
53+ ex.printStackTrace();
54+ } catch (SAXException ex) {
55+ ex.printStackTrace();
56+ } catch (ParserConfigurationException ex) {
57+ ex.printStackTrace();
58+ }
59+
60+ }
61+}
--- hoge/tofu/src/hoge/tofu/object/Unitdate.java (nonexistent)
+++ hoge/tofu/src/hoge/tofu/object/Unitdate.java (revision 57)
@@ -0,0 +1,38 @@
1+/*
2+ * Unitdate.java
3+ *
4+ * Created on 2007/02/13, 10:13
5+ *
6+ * Hoge Project Tofu Library Assist making java app.
7+ * Copyright (C) 2006-2007 gn64_jp
8+ *
9+ * This library is free software; you can redistribute it and/or
10+ * modify it under the terms of the GNU Lesser General Public
11+ * License as published by the Free Software Foundation;
12+ * version 2.1 of the License.
13+ *
14+ * This library is distributed in the hope that it will be useful,
15+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17+ * Lesser General Public License for more details.
18+ *
19+ * You should have received a copy of the GNU Lesser General Public
20+ * License along with this library; if not, write to the Free Software
21+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22+ *
23+ */
24+
25+package hoge.tofu.object;
26+
27+/**
28+ *
29+ * @author gn64_jp
30+ */
31+public class Unitdate {
32+
33+ /** Creates a new instance of Unitdate */
34+ public Unitdate() {
35+ }
36+
37+
38+}
Show on old repository browser