OutputStream os = fc.getOutputStream(false); byte[] buf = strValue.getBytes(ENCODING); os.write(buf);
@Override public OutputStream openOutputFile(String fileName, boolean append) throws IOException { checkBasics("openOutputFile"); URL fileURL = fileNameToURL(fileName); try { FileContents fc = null; try { fc = ps.get(fileURL); } catch (FileNotFoundException e) { /* Verify that the max size for new PersistenceService * files is >= 100K (2^17) before opening one. */ long maxSizeRequest = 131072L; long maxSize = ps.create(fileURL, maxSizeRequest); if (maxSize >= maxSizeRequest) { fc = ps.get(fileURL); } } if ((fc != null) && (fc.canWrite())) { return new BufferedOutputStream(fc.getOutputStream(!append)); } else { throw new IOException("unable to create FileContents object"); } } catch (Exception e) { throw new IOException("openOutputFile \"" + fileName + "\" failed", e); } }
public OutputStream openOutputFile(String fileName) throws IOException { checkBasics("openOutputFile"); URL fileURL = fileNameToURL(fileName); try { FileContents fc = null; try { fc = ps.get(fileURL); } catch (FileNotFoundException e) { /* Verify that the max size for new PersistenceService * files is >= 100K (2^17) before opening one. */ long maxSizeRequest = 131072L; long maxSize = ps.create(fileURL, maxSizeRequest); if (maxSize >= maxSizeRequest) { fc = ps.get(fileURL); } } if ((fc != null) && (fc.canWrite())) { return new BufferedOutputStream(fc.getOutputStream(true)); } else { throw new IOException("unable to create FileContents object"); } } catch(Exception e) { throw new LSException("openOutputFile \"" + fileName + "\" failed", e); } }