类java.io.BufferedWriter源码实例Demo

下面列出了怎么用java.io.BufferedWriter的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: gemfirexd-oss   文件: GFInputFormatJUnitTest.java
@Override
protected void configureHdfsStoreFactory() throws Exception {
  super.configureHdfsStoreFactory();

  configFile = new File("testGFInputFormat-config");
  String hadoopClientConf = "<configuration>\n             "
      + "  <property>\n                                    "
      + "    <name>dfs.block.size</name>\n                 "
      + "    <value>2048</value>\n                         "
      + "  </property>\n                                   "
      + "  <property>\n                                    "
      + "    <name>fs.default.name</name>\n                "
      + "    <value>hdfs://127.0.0.1:" + CLUSTER_PORT + "</value>\n"
      + "  </property>\n                                   "
      + "  <property>\n                                    "
      + "    <name>dfs.replication</name>\n                "
      + "    <value>1</value>\n                            "
      + "  </property>\n                                   "
      + "</configuration>";
  BufferedWriter bw = new BufferedWriter(new FileWriter(configFile));
  bw.write(hadoopClientConf);
  bw.close();
  hsf.setHDFSClientConfigFile(configFile.getName());
}
 
public static void semEvalTest() throws Exception
{
	Arrays.sort(FramesSemEval.testSet);
	sentenceNum = 0;
	BufferedWriter bWriterFrames = new BufferedWriter(new FileWriter("/mal2/dipanjan/experiments/FramenetParsing/framenet_1.3/ddData/semeval.fulltest.sentences.frames"));
	BufferedWriter bWriterFEs = new BufferedWriter(new FileWriter("/mal2/dipanjan/experiments/FramenetParsing/framenet_1.3/ddData/semeval.fulltest.sentences.frame.elements"));
	for(int j = 0; j < FramesSemEval.testSet.length; j ++)
	{
		String fileName = FramesSemEval.testSet[j];
		System.out.println("\n\n"+fileName);
		getSemEvalFrames(fileName,bWriterFrames);
		getSemEvalFrameElements(fileName,bWriterFEs);
	}		
	bWriterFrames.close();
	bWriterFEs.close();
}
 
源代码3 项目: samantha   文件: IndexerUtilities.java
public static void writeCSVFields(JsonNode entity, List<String> curFields, BufferedWriter writer,
                                  String separator) throws IOException {
    ObjectMapper mapper = new ObjectMapper();
    List<String> fields = new ArrayList<>(curFields.size());
    for (String field : curFields) {
        String value;
        if (!entity.has(field)) {
            logger.warn("The field {} is not present in {}. Filled in with empty string.",
                    field, entity);
            value = mapper.writeValueAsString("");
        } else {
            value = mapper.writeValueAsString(entity.get(field));
        }
        if (value.contains(separator)) {
            logger.warn("The field {} from {} already has the separator {}. Removed.",
                    field, entity, separator);
            value = value.replace(separator, "");
        }
        fields.add(StringEscapeUtils.unescapeCsv(value));
    }
    String line = StringUtils.join(fields, separator);
    writer.write(line);
    writer.newLine();
    writer.flush();
}
 
源代码4 项目: RxZhihuDaily   文件: LogImpl.java
private static boolean outputToFile(String message, String path) {
	if (TextUtils.isEmpty(message)) {
		return false;
	}
	
	if (TextUtils.isEmpty(path)) {
		return false;
	}
	
	boolean written = false;
	try {
           BufferedWriter fw = new BufferedWriter(new FileWriter(path, true));
		fw.write(message);
		fw.flush();
		fw.close();
		
		written = true;
	} catch (Exception e) {
		e.printStackTrace();
	}
	
	return written;
}
 
源代码5 项目: netbeans   文件: DDHelper.java
public void run() {
    try {
        // PENDING : should be easier to define in layer and copy related FileObject (doesn't require systemClassLoader)
        if (toDir.getFileObject(toFile) != null) {
            return; // #229533, #189768: The file already exists in the file system --> Simply do nothing
        }
        FileObject xml = FileUtil.createData(toDir, toFile);
        String content = readResource(DDHelper.class.getResourceAsStream(fromFile));
        if (content != null) {
            FileLock lock = xml.lock();
            BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(xml.getOutputStream(lock)));
            try {
                bw.write(content);
            } finally {
                bw.close();
                lock.releaseLock();
            }
        }
        result = xml;
    }
    catch (IOException e) {
        exception = e;
    }
}
 
源代码6 项目: glowroot   文件: PreloadSomeSuperTypesCache.java
private void appendNewLinesToFile() throws FileNotFoundException, IOException {
    BufferedWriter out =
            new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file, true), UTF_8));
    try {
        int lineCount = 0;
        Iterator<String> i = needsToBeWritten.iterator();
        while (i.hasNext()) {
            String typeName = i.next();
            CacheValue cacheValue = checkNotNull(cache.get(typeName));
            writeLine(out, typeName, cacheValue);
            lineCount++;
        }
        linesInFile += lineCount;
    } finally {
        out.close();
    }
}
 
源代码7 项目: matrix-toolkits-java   文件: MatrixVectorIoTest.java
@Test
public void testSparseWriteRead() throws Exception {
    CompRowMatrix mat = new CompRowMatrix(3, 3, new int[][]{{1, 2}, {0, 2},
            {1}});
    mat.set(0, 1, 1);
    mat.set(0, 2, 2);
    mat.set(1, 0, 3);
    mat.set(1, 2, 4);
    mat.set(2, 1, 5);
    File testFile = new File("TestMatrixFile");
    testFile.deleteOnExit();
    BufferedWriter out = new BufferedWriter(new FileWriter(testFile));
    MatrixVectorWriter writer = new MatrixVectorWriter(out);
    MatrixInfo mi = new MatrixInfo(true, MatrixInfo.MatrixField.Real,
            MatrixInfo.MatrixSymmetry.General);
    writer.printMatrixInfo(mi);
    writer.printMatrixSize(
            new MatrixSize(mat.numColumns(), mat.numColumns(), mat
                    .getData().length), mi);
    int[] rows = buildRowArray(mat);
    writer.printCoordinate(rows, mat.getColumnIndices(), mat.getData(), 1);
    out.close();
    CompRowMatrix newMat = new CompRowMatrix(new MatrixVectorReader(
            new FileReader(testFile)));
    MatrixTestAbstract.assertMatrixEquals(mat, newMat);
}
 
源代码8 项目: rdf4j   文件: QueryServlet.java
@Override
protected void service(final WorkbenchRequest req, final HttpServletResponse resp, final String xslPath)
		throws IOException, RDF4JException, BadRequestException {
	if (!writeQueryCookie) {
		// If we suppressed putting the query text into the cookies before.
		cookies.addCookie(req, resp, REF, "hash");
		String queryValue = req.getParameter(QUERY);
		String hash = String.valueOf(queryValue.hashCode());
		queryCache.put(hash, queryValue);
		cookies.addCookie(req, resp, QUERY, hash);
	}
	if ("get".equals(req.getParameter("action"))) {
		ObjectNode jsonObject = mapper.createObjectNode();
		jsonObject.put("queryText", getQueryText(req));
		PrintWriter writer = new PrintWriter(new BufferedWriter(resp.getWriter()));
		try {
			writer.write(mapper.writeValueAsString(jsonObject));
		} finally {
			writer.flush();
		}
	} else {
		handleStandardBrowserRequest(req, resp, xslPath);
	}
}
 
源代码9 项目: incubator-retired-pirk   文件: HDFS.java
public static void writeFile(List<BigInteger> elements, FileSystem fs, Path path, boolean deleteOnExit)
{
  try
  {
    // create writer
    BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fs.create(path, true)));

    // write each element on a new line
    for (BigInteger element : elements)
    {
      bw.write(element.toString());
      bw.newLine();
    }
    bw.close();

    // delete file once the filesystem is closed
    if (deleteOnExit)
    {
      fs.deleteOnExit(path);
    }
  } catch (IOException e)
  {
    e.printStackTrace();
  }
}
 
源代码10 项目: pxf   文件: Hdfs.java
private void writeTableToStream(FSDataOutputStream stream, Table dataTable, String delimiter, Charset encoding) throws Exception {
    BufferedWriter bufferedWriter = new BufferedWriter(
            new OutputStreamWriter(stream, encoding));
    List<List<String>> data = dataTable.getData();

    for (int i = 0, flushThreshold = 0; i < data.size(); i++, flushThreshold++) {
        List<String> row = data.get(i);
        StringBuilder sBuilder = new StringBuilder();
        for (int j = 0; j < row.size(); j++) {
            sBuilder.append(row.get(j));
            if (j != row.size() - 1) {
                sBuilder.append(delimiter);
            }
        }
        if (i != data.size() - 1) {
            sBuilder.append("\n");
        }
        bufferedWriter.append(sBuilder.toString());
        if (flushThreshold > ROW_BUFFER) {
            bufferedWriter.flush();
        }
    }
    bufferedWriter.close();
}
 
源代码11 项目: opensim-gui   文件: ExcitationEditorJFrame.java
private void jSaveTemplateMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jSaveTemplateMenuItemActionPerformed
        String fileName = FileUtils.getInstance().browseForFilenameToSave(
                FileUtils.getFileFilter(".txt", "Save layout to file"), true, "excitation_layout.txt", this);
        if(fileName!=null) {
            try {
                OutputStream ostream = new FileOutputStream(fileName);
                BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(ostream));
                ExcitationsGridJPanel gridPanel = dPanel.getExcitationGridPanel();
                writer.write(gridPanel.getNumColumns()+"\n");
                for(int i=0; i<gridPanel.getNumColumns(); i++) 
                    gridPanel.getColumn(i).write(writer);
                writer.flush();
                writer.close();
            } catch (IOException ex) {
                ErrorDialog.displayExceptionDialog(ex);
            }
        }

 
// TODO add your handling code here:
    }
 
源代码12 项目: mPaaS   文件: AutoCodeGenerator.java
private void writeApi() {
    String path = createDirFile("api", "api");
    try (BufferedWriter apiInput = new BufferedWriter(new FileWriter(getJavaFilePath(path, this.apiName)))) {
        apiInput.write(getPackageLine("api", "api") + "\r\n");
        apiInput.newLine();
        apiInput.write(importPrefix("com.ibyte.common.core.api.IApi;") + "\r\n");
        apiInput.write(getImportLine("dto", this.dtoName, "api") + "\r\n");
        apiInput.newLine();
        apiInput.write(buildComments());
        apiInput.write(String.format("public interface %s extends IApi<%s> {", this.apiName, this.dtoName) + "\r\n");
        apiInput.newLine();
        apiInput.write("}");
    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
public void saveModel(String modelFile)
{
	try
	{
		BufferedWriter bWriter = new BufferedWriter(new FileWriter(modelFile));
		for(int i = 0; i < modelSize; i ++)		
		{
			bWriter.write(params[i]+"\n");
		}
		bWriter.close();
	}
	catch(Exception e)
	{
		e.printStackTrace();
	}
}
 
源代码14 项目: teammates   文件: BaseLNPTestCase.java
/**
 * Creates the CSV data and writes it to the file specified by {@link #getCsvConfigPath()}.
 */
private void createCsvConfigDataFile(LNPTestData testData) throws IOException {
    List<String> headers = testData.generateCsvHeaders();
    List<List<String>> valuesList = testData.generateCsvData();

    String pathToCsvFile = createFileAndDirectory(TestProperties.LNP_TEST_DATA_FOLDER, getCsvConfigPath());
    try (BufferedWriter bw = Files.newBufferedWriter(Paths.get(pathToCsvFile))) {
        // Write headers and data to the CSV file
        bw.write(convertToCsv(headers));

        for (List<String> values : valuesList) {
            bw.write(convertToCsv(values));
        }

        bw.flush();
    }
}
 
源代码15 项目: Robot-Overlord-App   文件: MiscTests.java
/**
 * Used by plotXY() and plotXZ()
 * @param x
 * @param y
 * @param z
 * @param u
 * @param v
 * @param w
 * @param out
 * @param robot
 * @throws IOException
 */
private void plot(double x,double y,double z,double u,double v,double w,BufferedWriter out,Sixi2 robot) throws IOException {
	DHKeyframe keyframe0 = robot.sim.getIKSolver().createDHKeyframe();
	Matrix4d m0 = new Matrix4d();
	
	keyframe0.fkValues[0]=x;
	keyframe0.fkValues[1]=y;
	keyframe0.fkValues[2]=z;
	keyframe0.fkValues[3]=u;
	keyframe0.fkValues[4]=v;
	keyframe0.fkValues[5]=w;
				
	// use forward kinematics to find the endMatrix of the pose
	robot.sim.setPoseFK(keyframe0);
	m0.set(robot.sim.endEffector.getPoseWorld());
	
	String message = StringHelper.formatDouble(m0.m03)+"\t"
					+StringHelper.formatDouble(m0.m13)+"\t"
					+StringHelper.formatDouble(m0.m23)+"\n";
  		out.write(message);
}
 
void writeToLog(String message, boolean appendMode) {
    try {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss", Locale.US);
        String time = sdf.format(new Date());

        message = time + " - " + message;

        File logFile = new File(getLogFilePath());
        if (!logFile.getParentFile().exists()) {
            //noinspection ResultOfMethodCallIgnored
            logFile.getParentFile().mkdirs();
        }

        BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(logFile, appendMode));
        bufferedWriter.newLine();
        bufferedWriter.append(message);
        bufferedWriter.close();
    } catch (IOException e) {
        Log.e(TAG, "Exception in writeToLog", e);
    }
}
 
源代码17 项目: easyccg   文件: Rebanker.java
private void writeCatList(Multiset<Category> cats, File outputFile) throws IOException {
  Multiset<Category> catsNoPPorPRfeatures = HashMultiset.create();
  for (Category cat : cats) {
    catsNoPPorPRfeatures.add(cat.dropPPandPRfeatures());
  }
  FileWriter fw = new FileWriter(outputFile.getAbsoluteFile());
  BufferedWriter bw = new BufferedWriter(fw);
  
  
  int categories = 0;
  for (Category type : Multisets.copyHighestCountFirst(cats).elementSet()) {
    if (catsNoPPorPRfeatures.count(type.dropPPandPRfeatures()) >= 10) {
      bw.write(type.toString());
      bw.newLine();
      categories++;
    }
  }
  System.out.println("Number of cats occurring 10 times: " + categories);
  
  
  bw.flush();
  bw.close();
  

}
 
源代码18 项目: powsybl-core   文件: IeeeCdfReaderWriterTest.java
private void testIeeeFile(String fileName) throws IOException {
    IeeeCdfModel model;
    // read
    try (BufferedReader reader = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("/" + fileName)))) {
        model = new IeeeCdfReader().read(reader);
    }

    // write
    Path file = fileSystem.getPath("/work/" + fileName);
    try (BufferedWriter writer = Files.newBufferedWriter(file, StandardCharsets.UTF_8)) {
        new IeeeCdfWriter(model).write(writer);
    }

    // read
    IeeeCdfModel model2;
    try (BufferedReader reader = Files.newBufferedReader(file, StandardCharsets.UTF_8)) {
        model2 = new IeeeCdfReader().read(reader);
    }

    String json = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(model);
    String json2 = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(model2);
    assertEquals(json, json2);
}
 
源代码19 项目: besu   文件: TomlConfigFileDefaultProviderTest.java
@Test
public void invalidConfigContentMustThrow() throws IOException {

  exceptionRule.expect(ParameterException.class);
  exceptionRule.expectMessage(
      "Invalid TOML configuration: Unexpected '=', expected ', \", ''', "
          + "\"\"\", a number, a boolean, a date/time, an array, or a table (line 1, column 19)");

  final File tempConfigFile = temp.newFile("config.toml");
  try (final BufferedWriter fileWriter =
      Files.newBufferedWriter(tempConfigFile.toPath(), UTF_8)) {

    fileWriter.write("an-invalid-syntax=======....");
    fileWriter.flush();

    final TomlConfigFileDefaultProvider providerUnderTest =
        new TomlConfigFileDefaultProvider(mockCommandLine, tempConfigFile);

    providerUnderTest.defaultValue(OptionSpec.builder("an-option").type(String.class).build());
  }
}
 
源代码20 项目: lastfm-java   文件: Scrobbler.java
/**
 * Submits 'now playing' information. This does not affect the musical profile of the user.
 *
 * @param artist The artist's name
 * @param track The track's title
 * @param album The album or <code>null</code>
 * @param length The length of the track in seconds
 * @param tracknumber The position of the track in the album or -1
 * @return the status of the operation
 * @throws IOException on I/O errors
 */
public ResponseStatus nowPlaying(String artist, String track, String album, int length, int tracknumber) throws
		IOException {
	if (sessionId == null)
		throw new IllegalStateException("Perform successful handshake first.");
	String b = album != null ? encode(album) : "";
	String l = length == -1 ? "" : String.valueOf(length);
	String n = tracknumber == -1 ? "" : String.valueOf(tracknumber);
	String body = String
			.format("s=%s&a=%s&t=%s&b=%s&l=%s&n=%s&m=", sessionId, encode(artist), encode(track), b, l, n);
	if (Caller.getInstance().isDebugMode())
		System.out.println("now playing: " + body);
	HttpURLConnection urlConnection = Caller.getInstance().openConnection(nowPlayingUrl);
	urlConnection.setRequestMethod("POST");
	urlConnection.setDoOutput(true);
	OutputStream outputStream = urlConnection.getOutputStream();
	BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(outputStream));
	writer.write(body);
	writer.close();
	InputStream is = urlConnection.getInputStream();
	BufferedReader r = new BufferedReader(new InputStreamReader(is));
	String status = r.readLine();
	r.close();
	return new ResponseStatus(ResponseStatus.codeForStatus(status));
}
 
源代码21 项目: TranskribusCore   文件: TrpIobBuilder.java
private void addBeginningTag(CustomTag temp, BufferedWriter textLinebw, boolean exportProperties) throws IOException {
	if(temp.getTagName().equals("person")) {
			textLinebw.write("\tB-PER\tO");
			if(exportProperties) {
				addPropsToFile(temp, textLinebw);
			}
	}else if(temp.getTagName().equals("place")){
		textLinebw.write("\tB-LOC\tO");
		if(exportProperties) {
			addPropsToFile(temp, textLinebw);
		}
	}else if(temp.getTagName().equals("organization")){
		textLinebw.write("\tB-ORG\tO");
		if(exportProperties) {
			addPropsToFile(temp, textLinebw);
		}
	}else if(temp.getTagName().equals("human_production")){
		textLinebw.write("\tB-HumanProd\tO");
		if(exportProperties) {
			addPropsToFile(temp, textLinebw);
		}
	}
	
}
 
源代码22 项目: geogrid   文件: ISEA3H.java
private void _writeChunkToFile() throws IOException {
    Collections.sort(this._cells);
    File file = new File(this._filename + ".face" + this._face + "." + this._chunk);
    try (BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(file))){
        for (Long a : this._cells) {
            bufferedWriter.append(a.toString());
            bufferedWriter.newLine();
        }
    }
    this._chunk++;
    this._cells = new ArrayList<>();
}
 
源代码23 项目: Java-Twirk   文件: TestSocket.java
TestSocket() throws IOException {
    is = new PipedInputStream(PIPE_BUFFER);
    os = new PipedOutputStream(is);
    writer = new BufferedWriter( new OutputStreamWriter(os, StandardCharsets.UTF_8) );

    // Incase the one using the socket writes data to it, that data ends up here
    voidStream = new OutputStream() {
        @Override
        public void write(int b) throws IOException {
            // Do nothing with whatever is written
        }
    };

    // An output stream can only be written to by the same thread.
    // Since multiple threads might call the putMessage method, it is
    // safer to wrap the writing to the stream in a separate thread
    Thread writeThread = new Thread( () -> {
        while(isAlive){
            String s = queue.next();
            if(s != null){
                try {
                writer.write(s + "\r\n");
                writer.flush();
                }
                catch (IOException ex) {
                    throw new RuntimeException(ex);
                }
            }
        }
    });
    writeThread.start();
}
 
源代码24 项目: radon   文件: Renamer.java
private void dumpMappings() {
    long current = System.currentTimeMillis();
    Main.info("Dumping mappings.");
    File file = new File("mappings.txt");
    if (file.exists())
        FileUtils.renameExistingFile(file);

    try {
        file.createNewFile(); // TODO: handle this properly
        BufferedWriter bw = new BufferedWriter(new FileWriter(file));

        mappings.forEach((oldName, newName) -> {
            try {
                bw.append(oldName).append(" -> ").append(newName).append('\n');
            } catch (IOException ioe) {
                Main.severe(String.format("Ran into an error trying to append \"%s -> %s\"", oldName, newName));
                ioe.printStackTrace();
            }
        });

        bw.close();
        Main.info(String.format("Finished dumping mappings at %s. [%dms]", file.getAbsolutePath(),
                tookThisLong(current)));
    } catch (Throwable t) {
        Main.severe("Ran into an error trying to create the mappings file.");
        t.printStackTrace();
    }
}
 
源代码25 项目: kylin   文件: ITDictionaryManagerTest.java
public MockDistinctColumnValuesProvider(String... values) throws IOException {
    File tmpFile = File.createTempFile("MockDistinctColumnValuesProvider", ".txt");
    PrintWriter out = new PrintWriter(
            new BufferedWriter(new OutputStreamWriter(new FileOutputStream(tmpFile), StandardCharsets.UTF_8)));

    set = Sets.newTreeSet();
    for (String value : values) {
        out.println(value);
        set.add(value);
    }
    out.close();

    tmpFilePath = HadoopUtil.fixWindowsPath("file://" + tmpFile.getAbsolutePath());
    tmpFile.deleteOnExit();
}
 
源代码26 项目: act   文件: Util.java
public static byte[] compressXMLDocument(Document doc) throws
    IOException, TransformerConfigurationException, TransformerException {
  Transformer transformer = getTransformerFactory().newTransformer();
  // The OutputKeys.INDENT configuration key determines whether the output is indented.

  DOMSource w3DomSource = new DOMSource(doc);
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  Writer w = new BufferedWriter(new OutputStreamWriter(new GZIPOutputStream(
      new Base64OutputStream(baos, true, 0, new byte[]{'\n'}))));
  StreamResult sResult = new StreamResult(w);
  transformer.transform(w3DomSource, sResult);
  w.close();
  return baos.toByteArray();
}
 
源代码27 项目: Music-Player   文件: M3UWriter.java
public static File write(Context context, File dir, Playlist playlist) throws IOException {
    if (!dir.exists()) //noinspection ResultOfMethodCallIgnored
        dir.mkdirs();
    File file = new File(dir, playlist.name.concat("." + EXTENSION));

    List<? extends Song> songs;
    if (playlist instanceof AbsCustomPlaylist) {
        songs = ((AbsCustomPlaylist) playlist).getSongs(context);
    } else {
        songs = PlaylistSongLoader.getPlaylistSongList(context, playlist.id);
    }

    if (songs.size() > 0) {
        BufferedWriter bw = new BufferedWriter(new FileWriter(file));

        bw.write(HEADER);
        for (Song song : songs) {
            bw.newLine();
            bw.write(ENTRY + song.duration + DURATION_SEPARATOR + song.artistName + " - " + song.title);
            bw.newLine();
            bw.write(song.data);
        }

        bw.close();
    }

    return file;
}
 
/**
 * This is a utility method that can be used to dump the contents of the iidToIdDB to a txt file.
 * 
 * @param dumpFilename
 *            Full path to the file where the dump will be written.
 * @throws Exception
 */
public void dumpiidToIdDB(String dumpFilename) throws Exception {
	DatabaseEntry foundKey = new DatabaseEntry();
	DatabaseEntry foundData = new DatabaseEntry();

	ForwardCursor cursor = iidToIdDB.openCursor(null, null);
	BufferedWriter out = new BufferedWriter(new FileWriter(new File(dumpFilename)));
	while (cursor.getNext(foundKey, foundData, LockMode.DEFAULT) == OperationStatus.SUCCESS) {
		int iid = IntegerBinding.entryToInt(foundKey);
		String id = StringBinding.entryToString(foundData);
		out.write(iid + " " + id + "\n");
	}
	cursor.close();
	out.close();
}
 
源代码29 项目: jdk8u-dev-jdk   文件: HttpsSocketFacTest.java
@Override
public void handle(HttpExchange t) throws IOException {
    t.sendResponseHeaders(200, message.length());
    BufferedWriter writer = new BufferedWriter( new OutputStreamWriter(t.getResponseBody(), "ISO8859-1"));
    writer.write(message, 0, message.length());
    writer.close();
    t.close();
}
 
源代码30 项目: chipster   文件: LoginTest.java
private File createTestJaasConfig(File testPasswdFile) throws IOException {
	File testJaasConfigFile = File.createTempFile("chipster-jaas-config-test", null);
	PrintWriter jWriter = new PrintWriter(new BufferedWriter(new FileWriter(testJaasConfigFile)));
	jWriter.println("Chipster {");
    jWriter.print("fi.csc.microarray.auth.SimpleFileLoginModule sufficient passwdFile=\"");
    jWriter.print(testPasswdFile.getPath());		
    jWriter.println("\";");
    jWriter.println("};");
	jWriter.close();
	return testJaasConfigFile;
}
 
 类所在包
 同包方法