Search in sources :

Example 66 with FileInputStream

use of java.io.FileInputStream in project titan by thinkaurelius.

the class MapReduceIndexJobs method cassandraRepair.

public static ScanMetrics cassandraRepair(String titanPropertiesPath, String indexName, String relationType, String partitionerName) throws InterruptedException, IOException, ClassNotFoundException {
    Properties p = new Properties();
    FileInputStream fis = null;
    try {
        fis = new FileInputStream(titanPropertiesPath);
        p.load(fis);
        return cassandraRepair(p, indexName, relationType, partitionerName);
    } finally {
        IOUtils.closeQuietly(fis);
    }
}
Also used : Properties(java.util.Properties) FileInputStream(java.io.FileInputStream)

Example 67 with FileInputStream

use of java.io.FileInputStream in project titan by thinkaurelius.

the class MapReduceIndexJobs method hbaseRemove.

public static ScanMetrics hbaseRemove(String titanPropertiesPath, String indexName, String relationType) throws InterruptedException, IOException, ClassNotFoundException {
    Properties p = new Properties();
    FileInputStream fis = null;
    try {
        fis = new FileInputStream(titanPropertiesPath);
        p.load(fis);
        return hbaseRemove(p, indexName, relationType);
    } finally {
        IOUtils.closeQuietly(fis);
    }
}
Also used : Properties(java.util.Properties) FileInputStream(java.io.FileInputStream)

Example 68 with FileInputStream

use of java.io.FileInputStream in project Shuttle by timusus.

the class TaggerUtils method copyFile.

static void copyFile(File sourceFile, File destFile) throws IOException {
    if (!destFile.getParentFile().exists())
        destFile.getParentFile().mkdirs();
    if (!destFile.exists()) {
        destFile.createNewFile();
    }
    FileChannel source = null;
    FileChannel destination = null;
    try {
        source = new FileInputStream(sourceFile).getChannel();
        destination = new FileOutputStream(destFile).getChannel();
        destination.transferFrom(source, 0, source.size());
    } finally {
        if (source != null) {
            source.close();
        }
        if (destination != null) {
            destination.close();
        }
    }
}
Also used : FileChannel(java.nio.channels.FileChannel) FileOutputStream(java.io.FileOutputStream) FileInputStream(java.io.FileInputStream)

Example 69 with FileInputStream

use of java.io.FileInputStream in project Shuttle by timusus.

the class TaggerUtils method copyFile.

static void copyFile(File sourceFile, FileOutputStream outputStream) throws IOException {
    FileChannel source = null;
    FileChannel destination = null;
    try {
        source = new FileInputStream(sourceFile).getChannel();
        destination = outputStream.getChannel();
        destination.transferFrom(source, 0, source.size());
    } finally {
        if (source != null) {
            source.close();
        }
        if (destination != null) {
            destination.close();
        }
    }
}
Also used : FileChannel(java.nio.channels.FileChannel) FileInputStream(java.io.FileInputStream)

Example 70 with FileInputStream

use of java.io.FileInputStream in project blueprints by tinkerpop.

the class GMLWriterTest method testEncoding.

// Note: this is only a very lightweight test of writer/reader encoding.
// It is known that there are characters which, when written by GMLWriter,
// cause parse errors for GraphMLReader.
// However, this happens uncommonly enough that is not yet known which characters those are.
public void testEncoding() throws Exception {
    Graph g = new TinkerGraph();
    Vertex v = g.addVertex(1);
    v.setProperty("text", "é");
    GMLWriter w = new GMLWriter(g);
    File f = File.createTempFile("test", "txt");
    f.deleteOnExit();
    OutputStream out = new FileOutputStream(f);
    w.outputGraph(out);
    out.close();
    Graph g2 = new TinkerGraph();
    GMLReader r = new GMLReader(g2);
    InputStream in = new FileInputStream(f);
    r.inputGraph(in);
    in.close();
    Vertex v2 = g2.getVertex(1);
    assertEquals("é", v2.getProperty("text"));
}
Also used : Vertex(com.tinkerpop.blueprints.Vertex) TinkerGraph(com.tinkerpop.blueprints.impls.tg.TinkerGraph) Graph(com.tinkerpop.blueprints.Graph) TinkerGraph(com.tinkerpop.blueprints.impls.tg.TinkerGraph) FileInputStream(java.io.FileInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) OutputStream(java.io.OutputStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) FileOutputStream(java.io.FileOutputStream) FileOutputStream(java.io.FileOutputStream) File(java.io.File) FileInputStream(java.io.FileInputStream)

Aggregations

FileInputStream (java.io.FileInputStream)6674 File (java.io.File)3110 IOException (java.io.IOException)3008 InputStream (java.io.InputStream)1744 FileOutputStream (java.io.FileOutputStream)1023 FileNotFoundException (java.io.FileNotFoundException)976 BufferedInputStream (java.io.BufferedInputStream)873 InputStreamReader (java.io.InputStreamReader)760 Test (org.junit.Test)680 BufferedReader (java.io.BufferedReader)622 Properties (java.util.Properties)613 ArrayList (java.util.ArrayList)368 DataInputStream (java.io.DataInputStream)328 OutputStream (java.io.OutputStream)299 ByteArrayInputStream (java.io.ByteArrayInputStream)268 ZipEntry (java.util.zip.ZipEntry)258 HashMap (java.util.HashMap)230 XmlPullParserException (org.xmlpull.v1.XmlPullParserException)200 ByteArrayOutputStream (java.io.ByteArrayOutputStream)188 XmlPullParser (org.xmlpull.v1.XmlPullParser)185