github.com/scottcagno/storage@v1.8.0/pkg/_bio/virtfp/virtfp.go (about) 1 package virtfp 2 3 import ( 4 "bufio" 5 "github.com/scottcagno/storage/pkg/_bio/buffer" 6 "io/fs" 7 ) 8 9 type VirtFile struct { 10 name string 11 buf *buffer.Buffer 12 r *bufio.Reader 13 w *bufio.Writer 14 dat fs.File 15 } 16 17 func OpenVirtFile(name string) *VirtFile { 18 buf := new(buffer.Buffer) 19 return &VirtFile{ 20 name: name, 21 buf: buf, 22 r: bufio.NewReader(buf), 23 w: bufio.NewWriter(buf), 24 } 25 } 26 27 func (vfp *VirtFile) Name() string { 28 return vfp.name 29 } 30 31 func (vfp *VirtFile) Size() int { 32 return vfp.buf.Cap() 33 } 34 35 func (vfp *VirtFile) Read(p []byte) (int, error) { 36 return vfp.buf.Read(p) 37 } 38 39 func (vfp *VirtFile) ReadAt(p []byte, off int64) (int, error) { 40 return vfp.buf.ReadAt(p, off) 41 } 42 43 func (vfp *VirtFile) Seek(off int64, whence int) (int64, error) { 44 return vfp.buf.Seek(off, whence) 45 } 46 47 func (vfp *VirtFile) Sync() error { 48 return nil 49 } 50 51 func (vfp *VirtFile) Truncate(size int64) error { 52 vfp.buf.Truncate(int(size)) 53 return nil 54 } 55 56 func (vfp *VirtFile) Write(p []byte) (int, error) { 57 return vfp.buf.Write(p) 58 } 59 60 func (vfp *VirtFile) WriteAt(p []byte, off int64) (int, error) { 61 return vfp.buf.WriteAt(p, off) 62 } 63 64 func (vfp *VirtFile) Close() error { 65 vfp.buf.Free() 66 return nil 67 } 68 69 var data = []byte(`Born here of parents born here from parents the same, and their parents the same, 70 I, now thirty-seven years old in perfect health begin, 71 Hoping to cease not till death. 72 73 Creeds and schools in abeyance, 74 Retiring back a while sufficed at what they are, but never forgotten, 75 I harbor for good or bad, I permit to speak at every hazard, 76 Nature without check with original energy. 77 78 2 79 Houses and rooms are full of perfumes, the shelves are crowded with perfumes, 80 I breathe the fragrance myself and know it and like it, 81 The distillation would intoxicate me also, but I shall not let it. 82 83 The atmosphere is not a perfume, it has no taste of the distillation, it is odorless, 84 It is for my mouth forever, I am in love with it, 85 I will go to the bank by the wood and become undisguised and naked, 86 I am mad for it to be in contact with me. 87 88 The smoke of my own breath, 89 Echoes, ripples, buzz’d whispers, love-root, silk-thread, crotch and vine, 90 My respiration and inspiration, the beating of my heart, the passing of blood and air through my lungs, 91 The sniff of green leaves and dry leaves, and of the shore and dark-color’d sea-rocks, and of hay in the barn, 92 The sound of the belch’d words of my voice loos’d to the eddies of the wind, 93 A few light kisses, a few embraces, a reaching around of arms, 94 The play of shine and shade on the trees as the supple boughs wag, 95 The delight alone or in the rush of the streets, or along the fields and hill-sides, 96 The feeling of health, the full-noon trill, the song of me rising from bed and meeting the sun. 97 98 Have you reckon’d a thousand acres much? have you reckon’d the earth much? 99 Have you practis’d so long to learn to read? 100 Have you felt so proud to get at the meaning of poems? 101 102 Stop this day and night with me and you shall possess the origin of all poems, 103 You shall possess the good of the earth and sun, (there are millions of suns left,) 104 You shall no longer take things at second or third hand, nor look through the eyes of the dead, nor feed on the spectres in books, 105 You shall not look through my eyes either, nor take things from me, 106 You shall listen to all sides and filter them from your self. 107 108 3 109 I have heard what the talkers were talking, the talk of the beginning and the end, 110 But I do not talk of the beginning or the end. 111 112 There was never any more inception than there is now, 113 Nor any more youth or age than there is now, 114 And will never be any more perfection than there is now, 115 Nor any more heaven or hell than there is now. 116 117 Urge and urge and urge, 118 Always the procreant urge of the world. 119 120 Out of the dimness opposite equals advance, always substance and increase, always sex, 121 Always a knit of identity, always distinction, always a breed of life. 122 123 To elaborate is no avail, learn’d and unlearn’d feel that it is so. 124 125 Sure as the most certain sure, plumb in the uprights, well entretied, braced in the beams, 126 Stout as a horse, affectionate, haughty, electrical, 127 I and this mystery here we stand. 128 129 Clear and sweet is my soul, and clear and sweet is all that is not my soul. 130 131 Lack one lacks both, and the unseen is proved by the seen, 132 Till that becomes unseen and receives proof in its turn. 133 134 Showing the best and dividing it from the worst age vexes age, 135 Knowing the perfect fitness and equanimity of things, while they discuss I am silent, and go bathe and admire myself. 136 137 Welcome is every organ and attribute of me, and of any man hearty and clean, 138 Not an inch nor a particle of an inch is vile, and none shall be less familiar than the rest. 139 140 I am satisfied—I see, dance, laugh, sing; 141 As the hugging and loving bed-fellow sleeps at my side through the night, and withdraws at the peep of the day with stealthy tread, 142 Leaving me baskets cover’d with white towels swelling the house with their plenty, 143 Shall I postpone my acceptation and realization and scream at my eyes, 144 That they turn from gazing after and down the road, 145 And forthwith cipher and show me to a cent, 146 Exactly the value of one and exactly the value of two, and which is ahead? 147 148 4 149 Trippers and askers surround me, 150 People I meet, the effect upon me of my early life or the ward and city I live in, or the nation, 151 The latest dates, discoveries, inventions, societies, authors old and new, 152 My dinner, dress, associates, looks, compliments, dues, 153 The real or fancied indifference of some man or woman I love, 154 The sickness of one of my folks or of myself, or ill-doing or loss or lack of money, or depressions or exaltations, 155 Battles, the horrors of fratricidal war, the fever of doubtful news, the fitful events; 156 These come to me days and nights and go from me again, 157 But they are not the Me myself. 158 159 Apart from the pulling and hauling stands what I am, 160 Stands amused, complacent, compassionating, idle, unitary, 161 Looks down, is erect, or bends an arm on an impalpable certain rest, 162 Looking with side-curved head curious what will come next, 163 Both in and out of the game and watching and wondering at it. 164 165 Backward I see in my own days where I sweated through fog with linguists and contenders, 166 I have no mockings or arguments, I witness and wait. 167 168 5 169 I believe in you my soul, the other I am must not abase itself to you, 170 And you must not be abased to the other. 171 172 Loafe with me on the grass, loose the stop from your throat, 173 Not words, not music or rhyme I want, not custom or lecture, not even the best, 174 Only the lull I like, the hum of your valvèd voice. 175 176 I mind how once we lay such a transparent summer morning, 177 How you settled your head athwart my hips and gently turn’d over upon me, 178 And parted the shirt from my bosom-bone, and plunged your tongue to my bare-stript heart, 179 And reach’d till you felt my beard, and reach’d till you held my feet. 180 181 Swiftly arose and spread around me the peace and knowledge that pass all the argument of the earth, 182 And I know that the hand of God is the promise of my own, 183 And I know that the spirit of God is the brother of my own, 184 And that all the men ever born are also my brothers, and the women my sisters and lovers, 185 And that a kelson of the creation is love, 186 And limitless are leaves stiff or drooping in the fields, 187 And brown ants in the little wells beneath them, 188 And mossy scabs of the worm fence, heap’d stones, elder, mullein and poke-weed. 189 `)